I used to use Luis' SMTP class until I had the need to send over 500 emails per hour with attachments in different formats.
I switched to Funcky SMTP component and it works great, even with servers requiring authentication.
WITH OBJECT oFunckyMail := TOleAuto():New("FUNCkySMTP")
:Server := "smtp.google.com" // with auth: user:pass@server"
:FromName := "Me, myself & I"
:FromAddress := "me@google.com"
:Subject := "Mail subjet"
:Message := "Hey guys! I had a really RAD time making " + CRLF +;
"the movie and I miss you guys. I am throwing "+ CRLF +;
"a party this weekend and you are all invited. " + CRLF +;
"Dont dis me, see ya soon... mua!"
:ToName := "My best friend"
:ToAddress := "bestfriend@friendship.com"
IF :Send()
MsgInfo("Sucess sending the message")
ELSE
MsgStop("Houston, we have a problem..."+CRLF+"Sending a message","Alert!"
ENDIF
END
TimStone wrote:Are attachments able to be included ?
I owned Funcky for many years for Clipper. What version is appropriate now for xHarbour ( Builder / xCC compiler ) ?
It looks on their website like they haven't touch it for 7 years.
Tim
WITH OBJECT oSmtp := TOleAuto():New("FUNCkySMTP")
:Server = "mail.tellurian.net"
:FromName = "Robert Boyle"
:FromAddress = "rboyle@tellurian.net"
:ToName = "Melissa Moorman"
:ToAddress = "melissa@tellurian.net"
:Subject = "Check out our new building"
:Attachments = "D:\Photos\Building\NewOffice.Gif"
// The following syntax attaches three pictures
* :Attachments = "NewOffice1.Gif, NewOffice2.Gif, OldOffice.Gif"
// The following syntax attaches all .Gif files in the folder
* :Attachments = "D:\Photos\Building\*.Gif"
// The following syntax attaches all Gifs, Bmps and Jpegs
* :Attachments = "*.Gif, *.Bmp, *.Jpg"
END
TimStone wrote:You indicated the Delphi version will work with xHarbour but I assume that means if you are building the Borland version.
I am using xCC/xBuilder which is the Microsoft Compatible version. Usually items built for Borland do not work for xCC.
TimStone wrote:Also, I was going to email Dirk yesterday but there is no method of communication on the website, nor is his sales link working. Some things require registration but you have to post an existing account for that to work.
function mailtest()
local oMail
local cHost := 'mail.myhost.com'
local cPopServer := cHost
local lNeedsAuth := .f.
local nPriority := 0 // Normal (Default)
local nSensitivity := 0 // Normal (Default)
local nNotify := 0 // None (Default)
local lSentOk
local cSubject
local cText
local cSendTo := 'gale.ford@wwrowland.com,help.desk@wwrowland.com'
local cMailFrom := 'me@myhost.com'
oMail := CreateObject("OSSMTP.SMTPSession")
oMail:Server := cHost
oMail:RaiseError := .f.
if lNeedsAuth
oMail:AuthenticationType := 2
oMail:Password := 'password'
oMail:Username := 'administrator@myhost.com'
oMail:ReplyTo := 'me@myhost.com"
oMail:POPServer := cPopServer
else
oMail:AuthenticationType := 0 // 0 = no authentication
endif
oMail:Importance := nPriority
oMail:Sensitivity := nSensitivity
// Needs comma seperator so if someone used semicolon change them to commas
oMail:SendTo := trim(strtran( cSendTo, ';', ',' ))
oMail:MailFrom := cMailFrom
oMail:MessageSubject := 'My test subject'
oMail:MessageText := 'Body of email.'
// Attachements *********************************
aFiles := { 'c:\autoexec.bat', 'c:\config.sys' }
for nCounter := 1 to len( aFiles )
oAttachment := CreateObject("OSSMTP.Attachment")
oAttachment:FilePath = aFiles[ nCounter ]
oAttachment:AttachmentName = cFileNoPath( aFiles[ nCounter ] )
if file( aFiles[ nCounter ] )
oMail:Attachments:add( oAttachment )
endif
next
// Attachements *********************************
oMail:SendEmail()
if upper( oMail:Status ) = 'ERROR'
lSentOk := .t.
else
lSentOk := .f.
endif
oMail := nil
return( lSentOk )
Return to FiveWin for Harbour/xHarbour
Users browsing this forum: shrifw and 63 guests