I am currently sending emails from code in Epicor Functions using the GetMailer() method that returns an ISmtpMailer.
I am wanting to change our emails from SMTP to Microsoft 365. I have set up the M365 Email Settings successfully, but any functions using GetMailer/ISmtpMailer are still sending via SMTP.
Anyone know how I can send emails via M365 from code in Functions?
You can send VIA M365 using SMTP protocol. What exactly do you mean by this?
To configure your email client or application to send emails through Office 365 (Microsoft 365), you'll need the following SMTP settings: Server name: smtp.office365.com, Port: 587 (recommended) or 25, Encryption: STARTTLS or SSL/TLS, Username: your full Office 365 email address, and Password: your Office 365 password.
Detailed Breakdown of Settings:
SMTP Server Name: smtp.office365.com.
SMTP Port:
587 (recommended): This port uses STARTTLS encryption, providing a secure connection for sending email.
25: This port can be used with TLS/SSL encryption, but port 587 is preferred for security.
Encryption:
STARTTLS: This is the recommended method and encrypts the connection after it's established.
SSL/TLS: Some clients may also support SSL/TLS encryption.
Username: Your full Office 365 email address (e.g., yourname@yourdomain.com).
Password: Your Office 365 account password.
Authentication: Ensure SMTP authentication is enabled.
Firewall and Network: Make sure your firewall and network settings permit outgoing connections on the specified port (587 or 25) to smtp.office365.com.
In Email Settings Maintenance you can set up the system to use Microsoft 365 mail directly via App Registration, not using SMTP. I don’t know of a way, in code, to take advantage of this form of email delivery. Epicor is doing it somehow, I’d like to do it in my Functions as well.
var mailSender = Ice.Lib.EmailSender.EmailSender.Create("EPIC06", "manager") as Ice.Lib.EmailSender.IEmailSender;
mailSender.SendBy("MsGraph",...) // all other paramters like any email