I'm trying to send email using JNDI, but for some strange reason the from field is not set.
context.xml:
<Resource name="email/user"
description="support email"
auth="Container"
type="javax.mail.Session"
username="user@server.net"
password="pass"
mail.debug="false"
mail.user="user@server.net"
mail.from="user@server.net"
mail.transport.protocol="smtp"
mail.host="mail.server.net"
mail.smtp.host="mail.server.net"
mail.smtp.auth="true"
mail.smtp.from="user@server.net"
mail.smtp.starttls.enable="true"
mail.smtp.submitter="user@server.net"/>
And how I'm getting this to application:
Context ctx = new InitialContext();
Session userEmail = (Session) ctx.lookup("java:comp/env/email/user");
And everything is fine, but when I'm sending this email to some servers I receive return message: We can't accept your message - missing From: (#5.3.0)
Additional question:
How to set nice looking from? I tried this:
mail.from="company XYZ <user@server.net>"
But it doesn't work....