#include "fivewin.ch"
FUNCTION Main()
LOCAL hOLEObject
Mail := TOleAuto():New("Persits.MailSender.4")
Mail:Host := "smtp.yourISP.com"
Mail:Port := 25
Mail:AddAddress( "emailTO@ISP.com" )
Mail:AddAttachment( "file.txt" )
Mail:From := "yourEmail@yourISP.com"
Mail:FromName := "Your Name Here"
Mail:UserName := "YourUserNameForAutenticate"
Mail:PassWord := "YourPasswordForAutenticate"
Mail:Subject := "Put a subject text"
Mail:Body := "Put a blablabla!"
//Mail:IsHtml := .t. // need help to this?
Mail:Send()
Mail:End()
return .t.
driessen wrote:3. How can I send emails from my application to Outlook, using OLE ?
#define olMailItem 0
FUNCTION MAIN()
LOCAL oOutlook, oMail
oOutlook = CREATEOBJECT( "Outlook.Application" )
oMail = oOutlook:CreateItem( olMailItem )
oMail:Recipients:Add( "e.m.giordano@emagsoftware.it" )
oMail:Subject = "Test"
oMail:Attachments:Add( "c:\xharbour\image.jpg" )
oMail:HTMLBody = MEMOREAD( "c:\xharbour\test.htm" )
oMail:Send()
oOutlook:Quit()
RETURN NIL
PROC SendOLMail( aTo, c_Msg, c_Subject, a_Files , c_HTML )
**************************************************************************************************
LOCAL oOutlook, oMail , el
TRY
oOutlook := GetActiveObject( "Outlook.Application" )
CATCH
TRY
oOutlook := CreateObject( "Outlook.Application" )
CATCH
? "ERROR! Outlook not avialable. [" + Ole2TxtError()+ "]"
RETURN
END
END
oMail := oOutlook:CreateItem( olMailItem )
FOR EACH el IN aTo
oMail:Recipients:Add( el )
NEXT
IF ! IsNil(c_Subject)
oMail:Subject := c_Subject //"Test message"
END
IF ! IsNil(c_Msg)
oMail:Body := c_Msg
END
IF ! IsNil(c_Html)
oMail:HTMLBody := c_Html
END
IF ! IsNil(a_Files) .AND. IsArray(a_Files)
FOR EACH el IN a_Files
oMail:Attachments:Add( el )
NEXT
END
oMail:Display = .T.
oMail := nil
RETURN
James Bott wrote:Manuel,
I don't know if this will work but have you tried:
oMail:HTMLBody = "c:\leb\fsoli.htm"
James
Item.HTMLBody = "<HTML><H2>My HTML page.</H2><BODY>My body.</BODY></HTML>"
EnricoMaria wrote:Please reduce the problem to a single self-contained PRG and show it here.
EMG
oMail:HTMLBody = "<HTML><H2>My HTML page.</H2><BODY>My body.</BODY></HTML>"
Return to FiveWin for Harbour/xHarbour
Users browsing this forum: nageswaragunupudi and 86 guests