View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
rhXX rhXX is offline
external usenet poster
 
Posts: 9
Default send a mail from VBA / excel

On May 31, 1:01 pm, Keith74 wrote:
http://www.paulsadowski.com/WSH/cdo.htm



keith, tks a lot!!!!!

that page shows how to use MS CDO

- i enabled its reference, and worked fine with the simple example

Sub Mail1()
Set objMessage = CreateObject("CDO.Message")
objMessage.Subject = "Example CDO Message"
objMessage.From = "
objMessage.To = "
objMessage.TextBody = "This is some sample message text."

'==This section provides the configuration information for the remote
SMTP server.
'==Normally you will only change the server name or IP.

objMessage.Configuration.Fields.item _
("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2

'Name or IP of Remote SMTP Server
objMessage.Configuration.Fields.item _
("http://schemas.microsoft.com/cdo/configuration/smtpserver") _
= "smtp.toto.com"

'Server port (typically 25)
objMessage.Configuration.Fields.item _
("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25

objMessage.Configuration.Fields.Update

'==End remote SMTP server configuration section==

objMessage.Send

End Sub