Different TO and RCPT fields?
843830Jan 19 2004 — edited Jan 21 2004Hi,
Using JavaMail, is it possible to send an email to a particular address yet have the "To" field (header) show something else?
I know in SMTP (I just tried it and it works) , you can do something like this:
mail from: me@someaccount.com
rcpt to: you@anotheraccount.com
data
To: somealias@nowhere.com
blah blah
.
And the effect will be that a mail message will be sent to "you@anotheraccount.com" but the "To" field will say that it is to "somealias@nowhere.com".
I've been trying to do the same thing in JavaMail but haven't had any luck. I can set the actual recipient via JavaMail using the "setRecipients" method--no problem. But when I try to change what gets displayed in the "To" header, it doesn't work.
I've tried the "addHeader" and "addHeaderLine" methods in MimeMessage. I've also tried setting the "mail.smtp.to". No luck, either way.
I have a ~feeling~ that this is just not possible with JavaMail. Can someone confirm this or show me how it's done?
Thanks,
Thomas