Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Send Email Through Gmail
Message
From
23/05/2011 03:15:01
 
General information
Forum:
Visual FoxPro
Category:
Classes - VCX
Miscellaneous
Thread ID:
01510492
Message ID:
01511452
Views:
263
LOCAL loConfig AS CDO.Configuration, loFlds AS Object, loMsg AS CDO.Message
SET STEP ON
loConfig = CREATEOBJECT("CDO.Configuration")

loFlds = loConfig.Fields

WITH loFlds

*- Set the CDOSYS configuration fields to use port 25 on the SMTP server.

.Item("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2

*- Enter name or IP address of remote SMTP server.

.Item("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "smtp.gmail.com"

.Item("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 465

*- Assign timeout in seconds

.Item("http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout") = 10

.Item("http://schemas.microsoft.com/cdo/configuration/smtpusessl") = .t.

*- Commit changes to the object

.Item("http://schemas.microsoft.com/cdo/configuration/sendusername") = "youraccout@gmail.com"

.Item("http://schemas.microsoft.com/cdo/configuration/sendpassword") = "password"

.Item("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = 3

* .item("http://schemas.microsoft.com/cdo/configuration/cdoURLProxyServer") = "smtp.mail.yahoo.com"

.Update()

ENDWITH

*- Create and send the message.

loMsg = CREATEOBJECT("CDO.Message")

WITH loMsg

.Configuration = loConfig

.To = "test@test.com"

.From = "youraccount@gmail.net"

.Subject = "This is a test of CDO sending e-mail"

.HTMLBody = "This is the HTML content of the mail message"

.AddAttachment("path of the file")

*- Set priority to HIGH if needed

*!* IF tlUrgent

*!* .Fields("Priority").Value = 1 && -1=Low, 0=Normal, 1=High

*!* .Fields.Update()

*!* ENDIF

TRY

.Send()

CATCH TO oerr

MESSAGEBOX(oerr.message)

ENDTRY

ENDWITH
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform