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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Emailing

Status
Not open for further replies.

SytzedeBoer

Programmer
Apr 1, 2013
15
NZ
Can anyone help me with a real problem I have

I will post the code below.
This is working fine for me if the smtp is smtp.gmail.com
I need this to also work with Yahoo and Outlook.com
With these two I get all kinds of spurious errors

loMail = NEWOBJECT("Cdo2000", "Cdo2000.fxp")
GO TOP IN Winkiss
gm1=winkiss.opt17 &&my email address
gm2=winkiss.empw && e.g. gmail password
gm3=ALLTRIM(winkiss.portnum)
IF EMPTY(gm3)
gm3="465"
endif

WITH loMail
.cServer = ALLTRIM(winkiss.opt15) && e.g. smtp.gmail.com
.nServerPort = 465
.lUseSSL = .T.
.nAuthenticate = 1 && cdoBasic
.cUserName = gm1
.cPassword = gm2
.cFrom = gm1
.cTo = "sytze@kiss.co.nz"
.cSubject = "CDO 2000 email through SMTP server "
.cTextBody = "This is a text body."
* .cAttachment = "myreport.pdf, myspreadsheet.xls"
ENDWITH

IF loMail.Send() > 0
FOR i=1 TO loMail.GetErrorCount()
? i, loMail.Geterror(i)
ENDFOR
loMail.ClearErrors()
ELSE
WAIT WINDOW NOWAIT "Your email was sent"
ENDIF
 
You'll need a user account on each server you use. I'd bet the unspecified errors you're getting are variations on "relays not allowed", which is extremely intentional and intended to keep spammers from using their server.

I'm curious why you're trying to use multiple servers? Usually, you only use one.
 
I am a software developer, so I do indeed have an account with Gamail and Outlook, and I have access/details to a client's Yahoo account for testing purposes
Hence the reason for multiple servers.

And, no, the message is not related to Relays
 
Well, without knowing what those error messages are should we pull a suggestion out of the air?
 
Error pops up as follows

With Yahoo I get
Error 1429
Line 62
Message: OLE IDispatch exception code 0 from ? The message could not be sent to the SMTP server.
The transport error code was 0x80040217. The server response was not available.

With Outlook.com I get
Error 1429
Line 62
Message: OLEIdispatch exception code 0 from CDO.Message,1: The transport failed to connect to the server

With Gmail it works fine
 
One thing that I notice is the SMTP Port definition in the code above.

Code:
.nServerPort = 465

Even though port 465 is used in some instances, the most typically used SMTP Ports are: 25 or 587 (see: )

Perhaps you need to contact the technical support at those other locations to confirm the Port setting required.

Good Luck,
JRB-Bldr
 
Even more general: Things like configuratrion often seem to be spurious errors, as you judged them, but are typically very systematic and should always make you think, how things differ. Even Mail/SMTP has several protocols and therefore also different configurations of eg Port.

Bye, Olaf.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top