hb_SendMail / tip_MailSend and CDO
Moderator: Rathinagiri
- Pablo César
- Posts: 4059
- Joined: Wed Sep 08, 2010 1:18 pm
- Location: Curitiba - Brasil
Compiling error by Marek
mol wrote:I'm using 32bit
Please give more information. Like what HMG version and what SO and if you tried as I indicated and in what case (hb_SendMail / tip_MailSend) is not compiling ?
I've tested this demo in another PC without any installation and works pretty well...
Very poor info...
Last edited by Pablo César on Sat Dec 10, 2016 1:39 am, edited 2 times in total.
HMGing a better world
"Matter tells space how to curve, space tells matter how to move."
Albert Einstein
"Matter tells space how to curve, space tells matter how to move."
Albert Einstein
mol
Hmg343, but I 'm out of office and home this week. I can test it at monday
mol
My app doesn't want to link. I'm using hb_sendmail.
I had problems with ssl, so I want to test these libraries
I had problems with ssl, so I want to test these libraries
- Pablo César
- Posts: 4059
- Joined: Wed Sep 08, 2010 1:18 pm
- Location: Curitiba - Brasil
hb_SendMail / tip_MailSend and CDO
I am proud and glad to introduce to you more this way of sending emails: vbs_SendMail ( via CDO )
The example is in VBScript (I love it, simple, practical, and powerful).
This new function does not require any extra library.
Please change emails address for testing.
I hope you like it.
Multiple address for To, Cc and BCc. Attached files and works in GMail server.
I have tested and it's workings perfectly !!! (Works like a charm, I'm happy)
The example is in VBScript (I love it, simple, practical, and powerful).
This new function does not require any extra library.
Please change emails address for testing.
I hope you like it.
Multiple address for To, Cc and BCc. Attached files and works in GMail server.
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
I have tested and it's workings perfectly !!! (Works like a charm, I'm happy)
HMGing a better world
"Matter tells space how to curve, space tells matter how to move."
Albert Einstein
"Matter tells space how to curve, space tells matter how to move."
Albert Einstein
- Pablo César
- Posts: 4059
- Joined: Wed Sep 08, 2010 1:18 pm
- Location: Curitiba - Brasil
hb_SendMail / tip_MailSend and CDO
Maybe some might think I just copied and posted ... But no.
I took this example in pure VBScript:
I relied on it, first tested it on the command line by writing it to .vbs file extension and: bingo! So I decided to convert line by line. I found several difficulties, but thanks to the internet, we can count on a great collection.
I have started by quite zero, but after I was able to compile, I saw that the sequence of creating message first and then configuring message: was reversed to the use case by Harbour. I saw this in an example of another forum.
Today I saw Daniel Maximiliano made and posted here in the forum but it's different. I feel mission accomplished, because it works first. If this code that I posted with the correct email addresses was written to a .vbs file and executed on the command line; Will work perfectly.
I took this example in pure VBScript:
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
I have started by quite zero, but after I was able to compile, I saw that the sequence of creating message first and then configuring message: was reversed to the use case by Harbour. I saw this in an example of another forum.
Today I saw Daniel Maximiliano made and posted here in the forum but it's different. I feel mission accomplished, because it works first. If this code that I posted with the correct email addresses was written to a .vbs file and executed on the command line; Will work perfectly.
HMGing a better world
"Matter tells space how to curve, space tells matter how to move."
Albert Einstein
"Matter tells space how to curve, space tells matter how to move."
Albert Einstein
Re: hb_SendMail / tip_MailSend and CDO
libeay.dll and ssleay.dll are dynamically linked libraries, so phrase:
is wrong and causes linker error.
Code: Select all
libs=libeay.dll
libs=ssleay.dll
- Pablo César
- Posts: 4059
- Joined: Wed Sep 08, 2010 1:18 pm
- Location: Curitiba - Brasil
hb_SendMail / tip_MailSend and CDO
.dll at your .hbc file.
Let it like I have indicated:
Remember also to be included:
libs=hbtip
libs=hbssl
After your right setup of .hbc you compile again.
But please do nothing to replace any original HMG library.
Marek, please remove Let it like I have indicated:
Remember also to be included:
libs=hbtip
libs=hbssl
After your right setup of .hbc you compile again.
But please do nothing to replace any original HMG library.
HMGing a better world
"Matter tells space how to curve, space tells matter how to move."
Albert Einstein
"Matter tells space how to curve, space tells matter how to move."
Albert Einstein
- Pablo César
- Posts: 4059
- Joined: Wed Sep 08, 2010 1:18 pm
- Location: Curitiba - Brasil
hb_SendMail / tip_MailSend and CDO
It's Ok, Marek. The important we found mistake at time of give up...
Have you tested with CDO way ? Any restrictions/disadvantages about CDO ?
Have you tested with CDO way ? Any restrictions/disadvantages about CDO ?
HMGing a better world
"Matter tells space how to curve, space tells matter how to move."
Albert Einstein
"Matter tells space how to curve, space tells matter how to move."
Albert Einstein