Am facing issue when sending email as attachment in my dev environment. The same code is working in production server.
I am able to send normal email by executing code in job and seems emails parameters are configured correctly.
Please find below error
System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.Net.Mail.SmtpException: Mailbox unavailable. The server response was: 5.7.1 Client does not have permissions to send as this sender
at System.Net.Mail.DataStopCommand.CheckResponse(SmtpStatusCode statusCode, String serverResponse)
at System.Net.Mail.DataStopCommand.Send(SmtpConnection conn)
at System.Net.ClosableStream.Close()
at System.Net.Mail.SmtpClient.Send(MailMessage message)
at Dynamics.Ax.Application.SysMailerNet.Sendmail() in SysMailerNet.sendMail.xpp:line 13
at Dynamics.Ax.Application.SysMailerNet.Quicksend(String fromAddr, String toAddr, String subject, String body, String cc, String attachments, Boolean , Boolean ) in SysMailerNet.quickSend.xpp:line 159
at Dynamics.Ax.Application.SysMailerNet.Quicksend(String fromAddr, String toAddr, String subject, String body, String cc, String attachments)
at Dynamics.Ax.Application.SrsReportRunMailer.Emailreport(SrsReportEMailDataContract _emailContract, String _attachmentPath) in SrsReportRunMailer.emailReport.xpp:line 24
--- End of inner exception stack trace ---
Please let me know if I need to check any setups or any help is highly appreciated.