HighTechTalks DotNet Forums  

Sending email from J#

Dotnet VJSharp microsoft.public.dotnet.vjsharp


Discuss Sending email from J# in the Dotnet VJSharp forum.



Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old   
Homer J Simpson
 
Posts: n/a

Default Sending email from J# - 02-02-2006 , 05:22 PM







Is there a good source of code for sending email from J# which isn't a
'deprecated' method? I find the documentation less than helpful.

H



Reply With Quote
  #2  
Old   
Homer J Simpson
 
Posts: n/a

Default Re: Sending email from J# - 02-02-2006 , 10:20 PM







"Homer J Simpson" <nobody (AT) nowhere (DOT) com> wrote

Quote:
Is there a good source of code for sending email from J# which isn't a
'deprecated' method? I find the documentation less than helpful.
To answer myself (after 16 tries):

import System.Net.Mail.*;

private void btnSend_Click(Object sender, System.EventArgs e)
{
MailAddress myTo = new MailAddress(toaddress);
MailAddress myFrom = new MailAddress(fromaddress);
MailMessage myMessage = new MailMessage(myFrom, myTo);
myMessage.set_Body("This is the body");
myMessage.set_Subject("This is the subject");
SmtpClient myClient = new SmtpClient("smtp.server.net");
myClient.Send(myMessage);
}

================================================== ==========
toaddress and fromaddress should be email addresses in quotes (which OE
obligingly screws up).





Reply With Quote
Reply




Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.