mol
Posted: Fri Dec 09, 2016 1:53 pm
I'm using 32bit
Exclusive forum for HMG, a Free / Open Source xBase WIN32/64 Bits / GUI Development System
http://www.hmgforum.com/
mol wrote:I'm using 32bit
Marek, in view of your difficulties with libraries, probably this will be your good choice to use it.mol wrote:Hmg343, but I 'm out of office and home this week. I can test it at monday
Code: Select all
EmailSubject = "Sending Email by CDO"
EmailBody = "This is the body of a message sent via" & vbCRLF & _
"a CDO.Message object using SMTP authentication ,with port 465."
' What's in [] must be replaced by its contains
Const EmailFrom = "[myemail]@gmail.com"
Const EmailFromName = "[myfull name]"
Const EmailTo = "[other email, could be my email too]@gmail.com"
Const SMTPServer = "smtp.gmail.com"
Const SMTPLogon = "[myemail]@gmail.com"
Const SMTPPassword = "[mypassword]"
Const SMTPSSL = True
Const SMTPPort = 465
Const cdoSendUsingPickup = 1 'Send message using local SMTP service pickup directory.
Const cdoSendUsingPort = 2 'Send the message using SMTP over TCP/IP networking.
Const cdoAnonymous = 0 ' No authentication
Const cdoBasic = 1 ' BASIC clear text authentication
Const cdoNTLM = 2 ' NTLM, Microsoft proprietary authentication
' First, create the message
Set objMessage = CreateObject("CDO.Message")
objMessage.Subject = EmailSubject
objMessage.From = """" & EmailFromName & """ <" & EmailFrom & ">"
objMessage.To = EmailTo
objMessage.TextBody = EmailBody
objMessage.AddAttachment "D:\Fontes\HMG\eMail\VBScript\Test1.txt" ' Full Path must be informed
objMessage.AddAttachment "D:\Fontes\HMG\eMail\VBScript\Test2.txt" ' Full Path must be informed
' Second, configure the server
objMessage.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
objMessage.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/smtpserver") = SMTPServer
objMessage.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = cdoBasic
objMessage.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/sendusername") = SMTPLogon
objMessage.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/sendpassword") = SMTPPassword
objMessage.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = SMTPPort
objMessage.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/smtpusessl") = SMTPSSL
objMessage.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout") = 60
objMessage.Configuration.Fields.Update
' Now send the message!
On Error Resume Next
objMessage.Send
If Err.Number <> 0 Then
MsgBox Err.Description,16,"Error Sending Mail"
Else
MsgBox "Mail was successfully sent !",64,"Information"
End If
Code: Select all
libs=libeay.dll
libs=ssleay.dll