Code

/*

This sample shows how to send mail via SMTP using an authenticated account

*/

#USING System.Net

#USING System.Net.Mail

 

FUNCTION Start() AS VOID

LOCAL oMailMsg AS MailMessage

LOCAL oClient AS SmtpClient

LOCAL oAttachment AS Attachment

LOCAL sSubject, sBody AS STRING

LOCAL oTo, oFrom AS MailAddress

oTo := MailAddress { "receiver@someplace.com.au" , "Joe Receiver" }

oFrom := MailAddress { "sender@otherplace.com.au" , "John Sender" }

sSubject := "Using authenticated SMTP from Vulcan.NET"

sBody := "Using this feature you can send " ;

   "an e-mail message from an application very easily."

oMailMsg := MailMessage{ oFrom, oTo }

oMailMsg:Subject := sSubject

oMailMsg:Body := sBody

oAttachment := Attachment{"Attachment.txt"}

oMailMsg:Attachments:Add(oAttachment)

oClient := SmtpClient{ "smtp.gmail.com" }

oClient:EnableSsl := TRUE

oClient:Credentials := NetworkCredential{ "gmail-id", "gmail-password" }

oClient:Send( oMailMsg )

RETURN

 

 Print  
Copyright 2012 GrafX Software DevelopmentTerms Of UsePrivacy Statement     Login