Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

PowerBuilder:Send email through SMTP in PB6.5

Status
Not open for further replies.

gy2cool

Programmer
Oct 20, 2010
16
0
0
IN
Hi friends,

I am trying to develop an application in PB6.5 which will send email through SMTP,without using any 3rd party application like,EasyMail.

Is it possible to write a powerscript which will send email automatically through SMTP?

I have tried the code mentioned below, but it is always giving some errors:

The Code:

OLEObject mailman
OLEObject eMail

mailman = Create OLEObject
eMail = Create OLEObject

li_return = mailman.ConnectToNewObject("ChilkatMail2.ChilkatMailMan2.1")
If li_return <> 0 Then
Destroy mailman
Return 98
End if

li_return = eMail.ConnectToNewObject("ChilkatMail2.ChilkatEMail2.1")
If li_return <> 0 Then
Destroy eMail
Return 97
End if

mailman.UnlockComponent("unlock-code")

mailman.SmtpHost = "smtp.mail.com"
mailman.SmtpPort = 25

eMail.AddTo("Support", "support@chilkatsoft.com")
eMail.Subject = "This is the email subject"
eMail.Body = "This is the email body."
eMail.From = "joe.programmer@somewhere.com"

mailman.SendEmail(eMail)

Errors:

the ConnectToNewObject function always throwing error


Plz help me out...........
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top