Date parsed: 07/10/2007 01:22:08
Date: Sun, 7 Oct 2007 00:22:08 +0100
"Vinnie" <centro.gamma@gmail.com> wrote in message
news:1191712197.555753.102300@y42g2000hsy.googlegroups.com...
>> public static void CreateTestMessage(string server)
>> {
>> try
>> {
>> string to = "j...@contoso.com";
>> string from = "b...@contoso.com";
>> 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
>> }
>>
>> }
> 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 "j...@contosom.com", 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...
--
Mark Rae
ASP.NET MVP
http://www.markrae.net