Query related to SMTP Mail

bordeauxbordeaux Member Posts: 3
Hi All,

I want to send mails for approval using SMTP (CU 400), mails should be sent using the mail id which will be dynamic, mapped on Employee Card.

I tried doing it by Basic SMTP setup using a fixed sender mail ID (test@xyz.com), it works fine, but here as per my requirement sender mail id will vary every time, it will not be fixed based on SMTP Setup.

I tried changing SMTP setup from Basic to Anonymous as well which also didn't help.

Used Codeunit Mail (CU 397), but did not receive any mails with that.

If any one has done this kinda thing before, please share your experience and ideas on this.

Thanks.

Comments

  • afarrafarr Member Posts: 287
    If you just want to change the Sender Address, then Codeunit 400 is enough, because CreateMessage has the following parameters: (SenderName,SenderAddress,Recipients,Subject,Body,HtmlFormatted);

    So you could do something like the following:
    SMTPMail.CreateMessage(Employee."Search Name",Employee."E-Mail",customer@client.com,'Hello','Test',FALSE);
    SMTPMail.Send;
    

    If different employees may be using different mail servers, then your code will need to modify the “SMTP Mail Setup” table before calling SMTPMail.Send
    Alastair Farrugia
  • bordeauxbordeaux Member Posts: 3
    Hi,

    This is the error which occurs while triggering the email action
    Microsoft Dynamics NAV Classic
    The SMTP mail system returned the following error: (0x8004020F): The server rejected one or more recipient addresses. The server response was: 553 5.7.1 <abc@gjepcindia.com>: Sender address rejected: not owned by user xyz@gjepcindia.com
    OK

    Any idea..What can be done...

    Thanks.
  • afarrafarr Member Posts: 287
    Can abc@gjepcindia.com send mail to xyz@gjepcindia.com (using a mail client like Outlook or Thunderbird, not through Navision)?

    A quick Google search didn't turn up any definite answers, except for some hints to check that the addresses you're using are valid, and have permissions to relay through the server.

    Try using a different SMTP server, just to check if the problem may be due to the server.
    I'm afraid I don't have any other suggestions.
    Alastair Farrugia
  • casanovacasanova Member Posts: 194
    anyone know how to fix this error?
    i'm using gmail as smtp server
    2.jpg 22.9K
Sign In or Register to comment.