web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics AX (Archived)

Email Notification sending Failed using Gmail SMTP Server

(0) ShareShare
ReportReport
Posted on by

Email Issue Detail: (Email notifications failed from Dynamics AX 2012 R3 CU8)

 

  • Client using Gmail SMTP Server for managing employee emails (outgoing Mail Server: smtp.gmail.com / Port: 587)
  • Email configurations done using following URL (all email setting done successfully)

https://technet.microsoft.com/en-us/library/aa834374.aspx

  • Email sending failed after batch job execution. 

after debugging sysEmailDistributor Class - ProcessEmails Method following exception thrown:

System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. --->System.Net.Mail.SmtpException: The SMTP server requires a secure connection or the client was not authenticated. The server response was: 5.7.0 Must issue a STARTTLS command first. 61sm20055911wrs.29 - gsmtp

   at System.Net.Mail.MailCommand.CheckResponse(SmtpStatusCode statusCode, String response)

   at System.Net.Mail.MailCommand.Send(SmtpConnection conn, Byte[] command, MailAddress from, Boolean allowUnicode)

   at System.Net.Mail.SmtpTransport.SendMail(MailAddress sender, MailAddressCollection recipients, String deliveryNotify, Boolean allowUnicode, SmtpFailedRecipientException& exception)

   at System.Net.Mail.SmtpClient.Send(MailMessage message)

   --- End of inner exception stack trace ---

   at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor)

   at System.Reflection.RuntimeMethodInfo.UnsafeInvokeInternal(Object obj, Object[] parameters, Object[] arguments)

   at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)

   at Microsoft.Dynamics.AX.ManagedInterop.ClrBridgeImpl.InvokeClrInstanceMethod(ClrBridgeImpl* , ObjectWrapper* objectWrapper, Char* pszMethodName, Int32 argsLength, ObjectWrapper** arguments, Boolean* argsAreByRef, Boolean* isException)

Please suggest? Is Dynamics AX support GMail smtp (SSL) or not?

 

 

 

*This post is locked for comments

I have the same question (0)
  • Community Member Profile Picture
    on at

    Dynamics AX supports SSL. You just need to set the following property of SMTPClient:

    smtpClient.set_EnableSsl(true);

    Have you written your own code for email notification or the default code of Dynamics AX?

  • Martin Dráb Profile Picture
    237,904 Most Valuable Professional on at

    Make sure you check older threads on this topic, such as e-mail parameters by using gmail SMTP? and Send email with X++ and a free SMTP server.

  • Community Member Profile Picture
    on at

    @numanijaz where we need to put this code in default dynamics ax functionality. what i know batch job for Email distributor use sysEmailDistributor class. please mention the exact place for putting this code?

     

  • Community Member Profile Picture
    on at

    Martin Dráb i read the respective posts. but mostly they are mentioning to put intermediate SMTP Server in order to make integration with Gmail SMTP server using SSL. our client having business gmail account and wan't in link directly.

    Is there any limitation in Dynamics AX for SSL?

  • Community Member Profile Picture
    on at

    @numanijaz where we need to put this code in default dynamics ax functionality. what i know batch job for Email distributor use sysEmailDistributor class. please mention the exact place for putting this code?

  • Community Member Profile Picture
    on at

    we are using the default code of Dynamics ax.

  • Verified answer
    Community Member Profile Picture
    on at

    Thanks Guys. Following solution worked in my case.

    1) Don’t put local computer name in System Administration >System > Email Parameters screen. only put outgoing mail server / SMTP Port / Username and password.

     

    2) Also change the code in SysMailerNet Class in Dynamic AX as follows

     

    public void sendMail()

    {

        // Send mail

        //Added this line

        smtpClient.set_EnableSsl(true);

       

        smtpClient.Send(mailMessage);

    }

  • Community Member Profile Picture
    on at

    @numanijaz you suggested solution works in normal batch but when batch process checkbox is enable and system post a batch job if failed again. where else we need to enable ssl in code?

  • Verified answer
    Martin Dráb Profile Picture
    237,904 Most Valuable Professional on at

    Make sure you didn't forget to generate CIL code after compiling X++.

  • Community Member Profile Picture
    on at

    what's the effect of not converting to CIL? please explain? email sending successfully through batch screen if put current date. Email failed if make the batch process or later date of 10 minutes or more?

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics AX (Archived)

#1
Martin Dráb Profile Picture

Martin Dráb 4 Most Valuable Professional

#1
Priya_K Profile Picture

Priya_K 4

#3
MyDynamicsNAV Profile Picture

MyDynamicsNAV 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans