NAV 2016 Email Error

rnjbng
rnjbng Member Posts: 82
Hi -

I have a very simple code in a report which is as follows in NAV 2016. When I execute this code I get the an error showed below after the code. SMTP mail setup table has been setup correctly and test email works just fine and the sender email is a super user within NAV.
Any help is highly appreciated.

UserSetup.RESET;
UserSetup.SETRANGE("User ID",USERID);
UserSetup.SETFILTER("POS From E-Mail",'<>%1','');
UserSetup.SETFILTER("POS To E-Mail",'<>%1','');
IF UserSetup.FIND('-') THEN BEGIN
//Create Subject text for email
SubjectText := 'POS-AP Transaction has been created dated :'+' '+FORMAT(TODAY);
//Create body text for email
BodyText := 'A POS File was created for the above date. Please review.';
//Address the mail
Mail.CreateMessage('POS',UserSetup."POS From E-Mail",UserSetup."POS To E-Mail",
SubjectText,BodyText,FALSE);
//Send out email
Mail.Send;


Error Message
The SMTP mail system returned the following error:"Mailbox unavailable. The Server response was:
5.7.60 SMTP; Client does not have permission to send as this sender.


Many Thanks
RJ.

Answers

  • archer89
    archer89 Member Posts: 337
    seems to be a mail server setup issue. maybe a relying issue.
    best regards
    Franz Kalchmair, MVP
    Alias: Jonathan Archer

    please like / agree / verify my answer, if it was helpful for you. thx.
    Blog: http://moxie4nav.wordpress.com/
  • rnjbng
    rnjbng Member Posts: 82
    Thanks archer89, I will have our client review their mail server setup and also have them check their mail relay. Thanks again for your prompt response.
  • ayhan06
    ayhan06 Member Posts: 210
    Connection to smtp server uses login credentials on smtp setup screen. But the email seems that it is going to be sent from another account -usersetup.pos from email field. So the account on smtp setup screen should have permission of 'send email on behalf of usersetup.'pos from email'. To check this, you may try this:enter credentials of usersetup.'pos from email' into smtp setup screen and try sending again. This time email will be sent properly.

    So Your system administrator should solve this issue