new link

  • Thread starter Thread starter Vinnie
  • Start date Start date
V

Vinnie

I have made a small form to send the mail to the websmaster, but i
don;t know how to code this action:

if the mail was sent successfully, than go to the url www.xxxyyyzzz.com

Thanks
Vinnie
 
I have made a small form to send the mail to the websmaster, but i
don;t know how to code this action:

if the mail was sent successfully, than go to the url www.xxxyyyzzz.com

Slightly modified from:
http://msdn2.microsoft.com/en-us/library/swas0fwc(vs.80).aspx

public static void CreateTestMessage(string server)
{
try
{
string to = "(e-mail address removed)";
string from = "(e-mail address removed)";
MailMessage message = new MailMessage(from, to);
message.Subject = "Using the new SMTP client.";
message.Body = "Hello";
SmtpClient client = new SmtpClient(server);
client.Send(message);
Response.Redirect("www.xxxyyyzzz.com", false);
}
catch (Exception ex)
{
// do something
}
}
 
Slightly modified from:http://msdn2.microsoft.com/en-us/library/swas0fwc(vs.80).aspx
public static void CreateTestMessage(string server)
{
try
{
string to = "(e-mail address removed)";
string from = "(e-mail address removed)";
MailMessage message = new MailMessage(from, to);
message.Subject = "Using the new SMTP client.";
message.Body = "Hello";
SmtpClient client = new SmtpClient(server);
client.Send(message);
Response.Redirect("www.xxxyyyzzz.com", false);
}
catch (Exception ex)
{
// do something
}

}

hi Mark, taanks a lot.

I have modified the code in this way, do you think it will work? I
have this concerns:
a) is the conversion that i placed in the TO and FROM, in the right
way?
b) in the catch function, what code should be placed?
 
I have modified the code in this way, do you think it will work? I
have this concerns:
a) is the conversion that i placed in the TO and FROM, in the right
way?

Only if there is really an email address "(e-mail address removed)", which seems
unlikely...
b) in the catch function, what code should be placed?

Depends how you're doing your exception handling... If you don't need to
handle the expection in this code, it will bubble up to the calling
method...
 
Only if there is really an email address "(e-mail address removed)", which seems
unlikely...


Depends how you're doing your exception handling... If you don't need to
handle the expection in this code, it will bubble up to the calling
method...

I got this error msg, what's about?

CS0246: The type or namespace name 'MailMessage' could not be found
(are you missing a using directive or an assembly reference?)
 
Back
Top