cleanair4me
Technical User
- May 16, 2008
- 61
When I send mail in my Java it always outputs the from address with the email address as it should where the email goes to the person and the person can reply back to the sender email address:
From: smith@place.com
To: jones@place.com
Subject: Hello World
I would like to display the name and also have their email address available so the person can reply back to it:
From: John Smith <smith@place.com>
To: jones@place.com
Subject: Hello World
I was wondering if I could use this: to="John Smith <smith@place.com>"
My current email program:
Please advise.
From: smith@place.com
To: jones@place.com
Subject: Hello World
I would like to display the name and also have their email address available so the person can reply back to it:
From: John Smith <smith@place.com>
To: jones@place.com
Subject: Hello World
I was wondering if I could use this: to="John Smith <smith@place.com>"
My current email program:
Code:
String to = "smith@place.com";
String from = "jones@place.com";
String host = "smtp.mycompany.net";
Properties props = new Properties();
props.put("mail.smtp.host", host);
props.put("mail.debug", "true");
Session session = Session.getInstance(props);
try {
// Instantiatee a message
Message msg = new MimeMessage(session);
....