You are here:
Set Reply-To Header for Email Messages
Control where email replies are sent by setting the Reply-To header using the new addReplyTo method in the dw.net.Mail class. This allows recipients to reply to a different address than the sender, such as replying to a support team address when the From address is a no-reply address.
The dw.net.Mail class now includes the addReplyTo(String) method to add Reply-To addresses to email messages.
Use this method when you want replies directed to a different address than the From address.
For example, send email from noreply@brand.com but have replies go to
support@brand.com.
You can call this method multiple times to add multiple Reply-To addresses. Each address must conform to the RFC822 standard. The method returns the Mail object to support method chaining.
Where: This feature applies to B2C Commerce.
How: Use the new method in your scripts when creating email with the dw.net.Mail class. For example:
var mail = new dw.net.Mail();
mail.setFrom("noreply@brand.com");
mail.addReplyTo("support@brand.com");
mail.addTo("customer@example.com");
mail.setSubject("Order Confirmation");
mail.setContent("Thank you for your order.");
mail.send();
