Hi,
I wrote a report using HTML stuff to compile the data and send that as table through Email. Everything is good except that i am getting following error,
The SMTP mail system returned the following error: "The SMTP server requires a secure connection or the client was not authenticated. The server response was: 5.7.57 SMTP; Client was not authenticated to send anonymous mail during MAIL FROM
This is the SMTP setting in NAV.
*This post is locked for comments
Glad you found the solution.
I also agree with Joathan. If I am not mistaken if you set the user email, then u don't have to specify the from address. NAV will take it from the user.
Sorry, yes this works ...thanks Robertas. Please ignore my below post. now i understand the concept.
Thanks....this works.
Hi,
when you create the message (extract from your code):
SMTPMail.CreateMessage('XYZ',SMTPSetup."User ID",Recipients,Subject,'',TRUE);
the second parameter has to be an actual e-mail, and you're passing the User ID. What you need to do is something along those lines:
UserSetup.GET(SMTPSetup."User ID");
UserSetup.TESTFIELD("E-Mail");
SMTPMail.CreateMessage('XYZ',UserSetup."E-Mail",Recipients,Subject,'',TRUE);
Hope that helps.
Robertas
Hi,
The Sender and receipient both are there.
Below is the Code,
Purch. Rcpt. Line - OnPreDataItem()
CLEAR(SMTPMail);
SMTPSetup.GET;
//SETRANGE("Posting Date",WORKDATE);
Recipients:= 'ABC@CorpXY.com';
Subject := 'Expense Receipt Notification' + ': ' + FORMAT(WORKDATE);
Body := 'Following Items are received on :' + FORMAT(WORKDATE);
CLEAR(SMTPMail);
SMTPMail.CreateMessage('XYZ',SMTPSetup."User ID",Recipients,Subject,'',TRUE);
SMTPMail.AppendBody('Hello,');
SMTPMail.AppendBody('<br><br>');
SMTPMail.AppendBody('<h1>'+ Body + '</h1>');
SMTPMail.AppendBody('<br><br>');
SMTPMail.AppendBody('<table border="1">');
SMTPMail.AppendBody('<tr>');
SMTPMail.AppendBody('<th><b>Document No.</th>');
SMTPMail.AppendBody('<th><b>Order No.</th>');
SMTPMail.AppendBody('<th><b>Item No.</th>');
SMTPMail.AppendBody('<th><b>Description</th>');
SMTPMail.AppendBody('<th><b>Quantity</th>');
SMTPMail.AppendBody('<th><b>Unit Cost(LCY)</th>');
SMTPMail.AppendBody('<th><b>Amount(LCY)</th>');
SMTPMail.AppendBody('</tr>');
Purch. Rcpt. Line - OnAfterGetRecord()
SMTPMail.AppendBody('<tr>');
SMTPMail.AppendBody('<td>' + FORMAT("Document No.") + '</td>');
SMTPMail.AppendBody('<td>' + FORMAT("Order No.") + '</td>');
SMTPMail.AppendBody('<td>' + FORMAT("No.") + '</td>');
SMTPMail.AppendBody('<td>' + FORMAT(Description) + '</td>');
SMTPMail.AppendBody('<td>' + FORMAT(Quantity) + '</td>');
SMTPMail.AppendBody('<td>' + FORMAT("Unit Cost (LCY)") + '</td>');
SMTPMail.AppendBody('<td>' + FORMAT("Unit Cost (LCY)" * Quantity) + '</td>');
SMTPMail.AppendBody('</tr>');
Purch. Rcpt. Line - OnPostDataItem()
SMTPMail.AppendBody('</table>');
SMTPMail.AppendBody('<br><br>');
SMTPMail.AppendBody('Thanks ');
SMTPMail.AppendBody(' ');
SMTPMail.AppendBody('<br><br>');
SMTPMail.AppendBody('<hr>');
SMTPMail.AppendBody('This is system generated mail. Please do not reply to this mail id.');
SMTPMail.Send;
When i use my ID as user Id in SMTP setup, its working but when i give a particular Notification id, than we have the above error. but this ID is working fine when sending Approval Emails with in NAV.
check if there is a mail address set in usersetup for the users.
check if the mail addresses can be used with the used smtp server (valid accounts).
check if account/password are valid for login at the used smtp server.
Please send us the code you are using for sending the email. It looks like you are not using the sender address while sending the email.
Yes, it is there.
Hi, not the Recipient, but the Sender is in question.
Hello,
yes, ofcourse i did specify recepient. om SMTP setup, when i send test Email(Test Email Setup), it works only for the id that we specify on User ID Field. I have checked with few Users IDs and all giving the same error when sending Emails to other id.
André Arnaud de Cal...
292,160
Super User 2025 Season 1
Martin Dráb
230,962
Most Valuable Professional
nmaenpaa
101,156