java mail replyTo problem

H

Hemant.Pahilwani

I am currently sending email from my application which sets ReplyTo
field. If i send this email to my outlook email and reply to this
email from outlook, then i behaves properly i.e. the To address in the
reply is the email address that i had set in ReplyTo field while
sending email. But if i send the email to gmail or yahoo and reply
to it, the ReplyTo address is same as as To email address, it is not
taking the value that i had set in ReplyTo field.

Ne ideas of what could be wrong? Given below is the function that
send out the email

public void send(String from, String to, String cc, String subject,
String text, String content_type,
String replyTo) {

javax.mail.Session session =
javax.mail.Session.getDefaultInstance(m_props, null);
MimeMessage msg = new MimeMessage(session);

try {
msg.setFrom(new InternetAddress(from));

if (replyTo != null) {
InternetAddress[] replyToAddress = new
InternetAddress[1];
replyToAddress[0] = new InternetAddress(replyTo);
msg.setReplyTo(replyToAddress);
}

msg.setRecipients(Message.RecipientType.TO,
InternetAddress.parse(to, false));
if (cc != null)
msg.setRecipients(Message.RecipientType.CC,
InternetAddress.parse(cc, false));

String enc = "UTF-8";

msg.setSubject(subject, enc);
..
..
..
..
..
..
.. String henc = ComergentI18N.getHTMLEncoding();

msg.setHeader("Content-Type"/*I18NOK:27751106*/,
content_type + ";charset="/*I18NOK:27771106*/ + henc/*I18NOK:
27761702*/);

msg.setHeader("Content-Encoding"/*I18NOK:a1d1106*/, henc);
// send the thing off
Transport.send(msg);
} catch (javax.mail.MessagingException e) {
String args[] = {e.getMessage()};
throw new ICCException(UtilErrors.ICC_E_SEND_SMTP_FAILED,
args);
}
}
 
R

Roedy Green

Ne ideas of what could be wrong? Given below is the function that
send out the email

Gmail likely has a bug. They might consider it a feature. Rude
people often use a reply to to direct responses to some disreputable
place.
 
S

Shantanu Joshi

I am currently sending email from my application which sets ReplyTo
field. If i send this email to my outlook email and reply to this
email from outlook, then i behaves properly i.e. the To address in the
reply is the email address that i had set in ReplyTo field while
sending email. But if i send the email to gmail or yahoo and reply
to it, the ReplyTo address is same as as To email address, it is not
taking the value that i had set in ReplyTo field.

Ne ideas of what could be wrong? Given below is the function that
send out the email

It's a bug/feature in GMail. In certain cases, GMail will ignore the
Reply-to header in the email and send replies to the sender of the
email. One case we noticed was if the From and To addresses are
identical (which might happen during testing).
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

java mail api 3
Javamail smtp port number 3
JavaMail Encoding Setting 0
Java mail problem 6
java send html mail problem 3
E-mail sending problem. 0
Email not working 0
java mail and thread 4

Members online

Forum statistics

Threads
473,733
Messages
2,569,439
Members
44,829
Latest member
PIXThurman

Latest Threads

Top