Can't make smtpmail.p work...

rcgomez11

Member
Good day ProgressTalkers,

OS: Windows 7 Ultimate
Progress Version: Progress 9.1e
SMTPMail Version: v5_8c
SMTP Server: smtp.gmail.com

I having hard times figuring out how can I make a module that can send email using smtpmail.p but it always prompt that there is no connection or when I supplied the STARTTLS with the value of 587 it will prompt something like I should run first a command related to STARTTLS. I know you can help me with my problem and it is really appreciated alot, thanks in advance...

Sincerely,
Romel Gomez
 

vdennis

Member
I use smtpmail as a backbone, both in UNIX and Windows. A no connection tells me that it cannot see what you are using as the hub.
In my programs I have an include smtpmail.i that sets the defaults for the program. Then is any value needs to be change that is done before calling smtpmail.p

So to start, I would like to know the settings for those var's.
Here is a simple program to test your connection, based on SMTPMAIL.

CODE FOLLOWS
DEF var loglevel AS INTEGER NO-UNDO.
DEF var mailhub AS CHARACTER NO-UNDO.
DEF var hSocket AS HANDLE NO-UNDO.
DEF VAR iPortNum AS INTEGER NO-UNDO.
assign
mailhub = "name of your mail servier:25". i.e. ServerName.yourcompany.com
IF iPortNum = 0 OR iPortNum = ? THEN iPortNum = 25.
CREATE SOCKET hSocket.
hSocket:SET-SOCKET-OPTION ("TCP-NODELAY", "FALSE").
hSocket:SET-SOCKET-OPTION ("SO-LINGER", "FALSE").
hSocket:SET-READ-RESPONSE-PROCEDURE ("readHandler",THIS-PROCEDURE).
hSocket:CONNECT("-H " + entry(1,MailHub,":")
+ " -S "
+ string(iPortNum)) NO-ERROR.
IF hSocket:CONNECTED() = FALSE THEN DO:
message
"No Connection"
view-as alert-box.
delete object hSocket.
RETURN.
END.
else do: /*end of Cannot make a connection to mail server */
Message
"We Got Connected"
view-as alert-box.
IF VALID-HANDLE(hSocket) THEN DO:
IF hSocket:CONNECTED() THEN hSocket:DISCONNECT() NO-ERROR.
DELETE OBJECT hSocket.
END. /* end of else do */
return.
end.

Try that for now.
-Dennis-
 

rcgomez11

Member
Before anything else I wanted to thank you for your effort sharing your knowledge with me.
I tried to replace the value of iPortNum and run it and it successfully connects me to the handle hSocket. What should i do next?
Hope you still have time for this post, thanks again and have a great day...

Sincerely,
Romel Gomez
 

vdennis

Member
Before anything else I wanted to thank you for your effort sharing your knowledge with me.
I tried to replace the value of iPortNum and run it and it successfully connects me to the handle hSocket. What should i do next?
Hope you still have time for this post, thanks again and have a great day...

Sincerely,
Romel Gomez

Try this code in the attachments.
vars-smtp.i assigns the Def's and the default values.
TestSmpt.p runs a test program that calls SMTPMAIL.p

I am also assuming that the GetHostName.p and base64encode.p are in the propath. Depending on what mail server you are using, you may need to edit gethoustname.
You WILL need to edit the .i to point to your mail server (mailhub) and edit the .p to point to GOOD to/from email addresses.

Also, there is a socketemail.log file, which you may have to search for, that can tell you line by line what is going on. Read the remarks about that file, where to find it, and how to change the level. A level 1 setting (default) is the most detailed and can eat up disk space.

If you are going to send attachments at some point, carefully read the requirements as failur to do so can cause a failed message.

Final thought. In cases where a connection fails, or any other reason beside a bad email address. smptmail does not 'hold' you message. I ended up create a 'storage' system for when that happens. Case would be if the mail server goes down. We lost over 1,000 email being sent due to that.
Let me know if you need any more, and the Attachments need to be downloaded asap or this site will delete them.
-Dennis-
 

Attachments

  • Testsm.p
    1.1 KB · Views: 123
  • vars-smtp.i
    5.2 KB · Views: 112

rcgomez11

Member
emailError.png


That error always prompting on me whenever I try to run smtpmail.p with mailhub "smtp.gmail.com:587", what do you think I'm missing?
Thanks and have great day.

Sincerely,
Romel Gomez
 

Marian EDU

Member
That error always prompting on me whenever I try to run smtpmail.p with mailhub "smtp.gmail.com:587", what do you think I'm missing?

Guess the error say it all... google uses SSL for email services, including outgoing SMTP. You might try to change the socket connect statement to use SSL, if your OE version allows you to, but not sure that this alone will solve your issue.
 

vdennis

Member
View attachment 993


That error always prompting on me whenever I try to run smtpmail.p with mailhub "smtp.gmail.com:587", what do you think I'm missing?
Thanks and have great day.

Sincerely,
Romel Gomez

I agree that it is a gmail security issue. We are using MS Exchange as our mail server/ with our domain name. SMTPmail does have some security features, but I am not sure if that will help.
L_DoAUTH LOGICAL - yes if authentication is requiered
C_AuthType CHAR - Type of authentication. Currently supported types:base64
C_User CHAR - The name of the SMTP server user
C_Password CHAR - The password of the SMTP server user


Depending on what you want out of this, you may have to set up with a company that can hand this request. I remember years ago that there are 'mail servers' out there that can do this for a fee, or you could purchase something like MS Exchange an go that way. Search the web for mail servers.
Good luck.
-Dennis-
 

rcgomez11

Member
Hey dennis,

Just want to thank you for supporting me on this matter, I got my smtpmail working, i tried AOL rather than yahoo and google, and it goes well.
Thank you and have a good day.

Sincerely,
Romel Gomez
 

vdennis

Member
Hey dennis,

Just want to thank you for supporting me on this matter, I got my smtpmail working, i tried AOL rather than yahoo and google, and it goes well.
Thank you and have a good day.

Sincerely,
Romel Gomez

For some reason I never got this email. Glad to know you got it working.
-Dennis-
 
Top