When sending emails via SMTP to Outlook recipients, the display name that appears can be influenced by how the email is formatted and the standards adhered to. Here are some key points to consider:
- Format of the From Address: Ensure that the format of the From address follows the recommended structure:
From: "Display Name" <EmailAddress>. The display name should be enclosed in double quotes, especially if it contains special characters or commas. - MAPI Properties: Outlook uses MAPI properties to interpret the email address components. The display name for all recipients is mapped to the
PR_DISPLAY_NAMEproperty. If the display name is not set correctly, Outlook may default to showing the email address instead. - Length Restrictions: If the total length of the email address plus display name exceeds 255 characters, the display name may be dropped. Make sure that your display name and email address combined do not exceed this limit.
- Testing with Different Libraries: Since you mentioned that PHPMailer works correctly, it may be beneficial to compare how both libraries handle the SMTP settings and the formatting of the email headers. Ensure that your Node.js application is setting the headers in a similar manner to PHPMailer.
- SMTP Server Configuration: Although you believe the SMTP server is not the issue, ensure that it is configured correctly to handle the display name and that there are no restrictions imposed by the server that could affect how the display name is sent.
If you continue to face issues, consider checking the specific email headers sent by both applications to identify any discrepancies that could affect how Outlook interprets the display name.
References: