"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).