1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
|
* Replace addresses with real ones before running the code
loMail = NEWOBJECT("Cdo2000", "Cdo2000.fxp")
WITH loMail
.cServer = "smtp.live.com"
.nServerPort = 25
.lUseSSL = .T.
.nAuthenticate = 1 && cdoBasic
.cUserName = "yourAccount@live.com"
.cPassword = "yourPassword"
*.cFrom = "yourlAccount@live.com"
.cFrom = .cUserName
.cTo = "somebody@otherdomain.com, somebodyelse@otherdomain.com"
.cSubject = "CDO 2000 email through MSN SMTP server"
* Uncomment next lines to send HTML body
*.cHtmlBody = "<html><body><b>This is an HTML body<br>" + ;
* "It'll be displayed by most email clients</b></body></html>"
.cTextBody = "This is a text body." + CHR(13) + CHR(10) + ;
"It'll be displayed if HTML body is not present or by text only email clients"
* Attachments are optional
* .cAttachment = "myreport.pdf, myspreadsheet.xls"
ENDWITH
IF loMail.Send() > 0
FOR i=1 TO loMail.GetErrorCount()
? i, loMail.Geterror(i)
ENDFOR
* Clear errors
loMail.ClearErrors()
ELSE
? "Email sent."
ENDIF
|
Comments
The transport failed to connect to the server
i get the above error trying to send via smtp.live.com (port 587).
The same config details (server, username, password, port etc) work through outlook2007 when i select TSL rather than SSL.
I can't find a cdo option to use TSL....
?
(Port 25 doesn't work either)
thanks
Nigel
Re: The transport failed to connect to the server
The CDO 2000 supports SSL only.
I run my code again and get the same error as you with port 587. I removed port 587 from the article.
It works fine with port 25, though. Maybe port 25 is blocked by a firewall or your ISP?
hmmm i get a 80040217 error
i get a 80040217 error "the server response was not available" with port 25.
I connect to other mail servers ok using port 25 so am pretty sure it's not firewall or ISP.
btw is it possible to send RTF in the message body?
CDO 2000 and RTF body
CDO 2000 directly supports plain text and HTML body types. For anything else you'll have to explore <a href="http://msdn.microsoft.com/en-us/library/aa487387%28EXCHG.65%29.aspx">IBodyPart Interface</a>.
@Sergey, your code (cdo2000)