Hi All,
I'm trying to send email from AX using codes below:
SysEmailId sysEmailId = "testEmail";
str recipientEmail = "abc@mail.com";
Map mappings;
;
super();
this.enabled(false);
mappings = new Map(Types::String, Types::String);
SysEmailTable::sendMail(
sysEmailId,
//'en-us',
SysEmailTable::find(sysEmailId).DefaultLanguage,
recipientEmail,
mappings,
'',
'',
true,
curUserId(),
true);
What I have done so far:
1. Setup the SMTP server on Windows Server
2. Setup email parameter in System Administration - Email Parameters
The emails are queued in Email Sending Status, but not being sent out to the recipient.
I also tried to send email using PowerShell
Send-MailMessage -SMTPServer localhost -To test@abc.com -From test@abc.com -Subject "This is a test email" -Body "Hi, this is a test email sent using Gmail as a smart host"
But got this error:
+ CategoryInfo : InvalidOperation: (System.Net.Mail.SmtpClient:SmtpClient) [Send-MailMessage], SmtpException
+ FullyQualifiedErrorId : SmtpException,Microsoft.PowerShell.Commands.SendMailMessage
I'm using my office email for the sender which is a Microsoft exchange account. Any idea what went wrong?
Thank you!
Regards,
Raymon