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?

Comments

  • edited May 2021
    Relaying denied happens when you are considered an unauthorized user. While this is most commonly due to an incorrect username/password, it can also happen when your credentials are fine but the server has decided for any number of reasons that you are not authorized to send mail. This latter case can happen if the email's From is different from your Username (some servers see this as possible attempt to spam). Perhaps this server doesn't like the To being the same as the From, but I'm not familiar with MailGun enough to say for sure. These are things you can mess with to see if you can get it working.

    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.
  • I agree that this is a message coming from the SMTP server, but I think the problem might be due to the lack of an Authenticate argument in the SMTPMail function.

    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.
  • Thanks Don, I do have OI 9.4 and was able to send a test email using RTI_SENDMAIL. Progress!
Sign In or Register to comment.