Welcome to the SRP Forum! Please refer to the SRP Forum FAQ post if you have any questions regarding how the forum works.
SMTPMAIL Function not working
I have not been able to send an email using the SMTPMAIL function in OpenInsight 9.4. The Return Value looks like this:
***************************************************
Return Value=REQS-All OK
INIT-220 Mailgun Influx ready
**sending - HELO OPTIPLEX
250 smtp-out-n03.prod.us-east-1.postgun.com
FROM-550 5.7.1 Relaying denied
RCPT-
DATA-
*************************************************
Reading on the MailGun site, relaying denied indicates a authorization problem but I know the server name, username, password, sender and recipient are correct because they work fine with SMTP Test Tool (https://www.gmass.co/smtp-test)
SUBROUTINE EMAIL (DUMMY)
DECLARE FUNCTION SMTPMAIL
DECLARE SUBROUTINE MSG
*
Html_Filename='c:\welcome.html'
MailServer='smtp.mailgun.org'
SenderName='sallykieckhefer@gmail.com'
Recipient='sallykieckhefer@gmail.com'
Subject='Test of Email Button'
Body='A line of text'
cc=''
bcc=''
UserName='postmaster@sandbox54139ee88a614a1b85ef2a0a7b42a1a6.mailgun.org'
Password='my..password'
*
Return_Value=SMTPMAIL(Html_Filename, MailServer, SenderName, Recipient, Subject, Body, cc, bcc, UserName, Password)
*
CONVERT @VM TO '-' IN Return_Value
CONVERT @FM TO '|' IN Return_value
MSG(@WINDOW,'Return Value = ':Return_Value)
RETURN
Any suggestions?
***************************************************
Return Value=REQS-All OK
INIT-220 Mailgun Influx ready
**sending - HELO OPTIPLEX
250 smtp-out-n03.prod.us-east-1.postgun.com
FROM-550 5.7.1 Relaying denied
RCPT-
DATA-
*************************************************
Reading on the MailGun site, relaying denied indicates a authorization problem but I know the server name, username, password, sender and recipient are correct because they work fine with SMTP Test Tool (https://www.gmass.co/smtp-test)
SUBROUTINE EMAIL (DUMMY)
DECLARE FUNCTION SMTPMAIL
DECLARE SUBROUTINE MSG
*
Html_Filename='c:\welcome.html'
MailServer='smtp.mailgun.org'
SenderName='sallykieckhefer@gmail.com'
Recipient='sallykieckhefer@gmail.com'
Subject='Test of Email Button'
Body='A line of text'
cc=''
bcc=''
UserName='postmaster@sandbox54139ee88a614a1b85ef2a0a7b42a1a6.mailgun.org'
Password='my..password'
*
Return_Value=SMTPMAIL(Html_Filename, MailServer, SenderName, Recipient, Subject, Body, cc, bcc, UserName, Password)
*
CONVERT @VM TO '-' IN Return_Value
CONVERT @FM TO '|' IN Return_value
MSG(@WINDOW,'Return Value = ':Return_Value)
RETURN
Any suggestions?
Comments
I don't think this is a problem with SmtpMail. It looks like SmtpMail did its job and returned the server's response. It's the server that's rejecting the email. Different servers have different rules.
Sally, I should apologize because I was the one who advised you during our phone call to use SMTPMail instead of RTI_CDOMail. I was correct when I mentioned that RTI_CDOMail had been deprecated and the errors you were seeing were indicative of the CDO library no longer working. However...SMPTMail is actually order than RTI_CDOMail rather than newer.
I knew there was a newer function so I did a little more digging. The function you should be using is called RTI_SendMail. There's just a couple of problems. First, this function doesn't exist in OI 9.2 (which is the version I believe you are using). It does exist in OI 9.4. The second problem is that this is undocumented even in OI 9.4. You can find the documentation in the online OI 10 Programmer's Reference Guide.
This leaves you with two options: 1.) Upgrade to OI 9.4. If you are an active WORKS subscriber then you can do this for free, or 2.) Purchase our SRP Mail Utility . Even if you decide to use our utility, I recommend you download and install it first. You can test our utility for free. Your emails will have a custom signature added, but in every other way it will fully functional.