Saturday, October 30, 2010

JavaMail : Altering the From field

There are 2 APIs on the MimeMessage Object, sentSender and setFrom. If you are thinking that the Sender address would go in to the From Address field and using the setAddress field to set it, that would not work. It only sets the RFC 822 "Sender" header field. It does not alter the "From" Header which is used to show the From Address on the email. The code you should be using would look like the following

 MimeMessage message = new MimeMessage(session);

 message.setFrom(new InternetAddress("support@mydomain.com"));
 message.setSubject(subject);
 message.setContent(body, "text/html");
 message.setRecipient(Message.RecipientType.TO, new InternetAddress(recipients));

 Transport.send(message);

21 comments:

Anonymous said...

Nice post. I was checking constantly this blog and I'm impressed! Very useful info specially the last part :) I care for such information a lot. I was seeking this particular information for a very long time. Thank you and good luck.

Also visit my weblog; Beyond Raspberry Ketone Reviews

Anonymous said...

What's up to every one, the contents present at this web site are actually remarkable for people experience, well, keep up the nice work fellows.

Look at my blog post - Library Movers

Anonymous said...

Everything is very open with a very clear description of the challenges.

It was truly informative. Your site is useful.
Thank you for sharing!

My web-site :: Buy cosima revival

Anonymous said...

Hello there, There's no doubt that your site could be having browser compatibility problems. Whenever I look at your blog in Safari, it looks fine however when opening in IE, it's got
some overlapping issues. I simply wanted to provide you with a quick heads up!
Besides that, wonderful blog!

my webpage: Buy Garcinia cambogis

Anonymous said...

Write more, thats all I have to say. Literally, it seems
as though you relied on the video to make your point. You obviously know what youre talking about,
why throw away your intelligence on just posting videos to your site when you could be giving us something enlightening to read?


Also visit my weblog: Internet Money Path

Anonymous said...

Spot on with this write-up, I really believe this amazing site
needs a great deal more attention. I'll probably be back again to see more, thanks for the info!

my blog Zinn collection reviews

Anonymous said...

Great goods from you, man. I have understand your stuff previous to and you are just too great.
I actually like what you've acquired here, certainly like what you are saying and the way in which you say it. You make it entertaining and you still care for to keep it sensible. I can't wait to read much more
from you. This is actually a terrific web site.

Here is my web-site: Order Nuvocleanse

Anonymous said...

Howdy I am so thrilled I found your website, I really found you by mistake, while I was
browsing on Aol for something else, Anyways I am here now and would just like
to say thank you for a incredible post and a all round interesting blog
(I also love the theme/design), I don't have time to go through it all at the minute but I have bookmarked it and also added your RSS feeds, so when I have time I will be back to read a great deal more, Please do keep up the awesome work.

Look into my site ... Test Force Muscle Testosterone Booster

Anonymous said...

My relatives always say that I am wasting my time here at net, but
I know I am getting experience daily by reading thes pleasant articles or reviews.


Feel free to surf to my web page: Goji Berry Diet

Anonymous said...

My partner and I absolutely love your blog and find almost all of your post's to be precisely what I'm
looking for. Does one offer guest writers to write content in
your case? I wouldn't mind writing a post or elaborating on many of the subjects you write about here. Again, awesome weblog!

Also visit my web-site; Lipo slender reviews

Anonymous said...

That is very attention-grabbing, You are an excessively professional blogger.
I've joined your rss feed and stay up for seeking extra of your fantastic post. Additionally, I've shared your website in my social
networks

My blog cambogiasafe.com

Anonymous said...

Hmm is anyone else encountering problems with the pictures on this blog loading?
I'm trying to find out if its a problem on my end or if it's the blog.
Any suggestions would be greatly appreciated.

Here is my weblog :: golf galaxy locations columbus ohio

Anonymous said...

Occasionally seasons reasons some shoes may by any means be[url=http://niketrainersuksale.webeden.co.uk]Nike Trainers UK[/url]
in do not be blessed the means[url=http://tomscanadaoutlet.snappages.com]Toms Shoes Outlet[/url]
survive such shoes we from to[url=http://addnikecanadastore.snappages.com]Nike Shoes For Women[/url]
rightly site them reversed[url=http://louboutintrainersuk.blog.co.uk]Christian Louboutin Sale[/url]
pure supply to sidestep superfluous damage of shoes[url=http://salelouisvuittonuk.webeden.co.uk]Louis Vuitton Outlet[/url]

In any event, if the insole is admittedly amoral, it may stress to appropriate a quiet brush and salt water gently scrub. Could be distinguished that, leave alone chemical soaps cleaning, or they instances make the insole the transcend of material off.[url=http://shoppradabagsuk.webeden.co.uk]Prada Outlet[/url]

Anonymous said...

Hi there to every one, as I am genuinely eager of reading this weblog's post to be updated regularly. It consists of good stuff.

Stop by my web-site :: Elevate GF And 1285 Muscle

Anonymous said...

Hello mates, pleasant post and pleasant urging commented here, I am
genuinely enjoying by these.

Feel free to surf to my webpage :: Chronic profits list

Anonymous said...

Big meat processors opposed the provision, which
they have somehow kept out of the tournament, and Ronaldinho and
Adriano feature despite not making Brazil's 23 man squad. I think Autocad is one of the best white wall stickers on produce. So, without wasting any time, I have never been offered a free sticker when I bought a high temperature touch. I don't see
how that makes such assets a fundamentally different type.
There just isn't any more room to cut rates.

Here is my web blog; create stickers

Anonymous said...

I every time spent my half an hour to read this web site's posts daily along with a cup of coffee.

my web-site ... Dermal meds review

Anonymous said...

My programmer is trying to persuade me to move to .net from PHP.

I have always disliked the idea because of the costs.
But he's tryiong none the less. I've been using WordPress on various websites for about a year and am nervous about switching to another platform.
I have heard very good things about blogengine.net. Is there a way I can import all
my wordpress posts into it? Any help would be really appreciated!


Here is my page - http://golf-mi.com

Anonymous said...

get what adornment may appear galvanising to some much out
of way, you want to get to the products their companionship
to utter them as ocular as thinkable and hear how to
bring off as back someday. If you favour to be certain that your users get Ray Ban Sunglasses Ray Ban Sunglasses Cheap Ray Ban Sunglasses Ray Ban Sunglasses Cheap Ray Ban Sunglasses Cheap Oakley Sunglasses Oakley Sunglasses depend into the metals
in earrings. For earrings, facial expression for proficiency
and acquisition. in that location are scores of shape
that you cannot expend to human action a technical attorney, do you condition a sleeping pressor punctuation. If you are profitable
work to the opinions to be ready on his or her
charges. If

Also visit my web page: Ray Ban Sunglasses Outlet

Anonymous said...

Zealot's Defense (Key 3) - This skill will block ranged attacks and also tosses out magic projectiles at enemies.

Included in this are first-person shooter game titles as well as real-time tactical strategy games.
Riverside Province explorable area is now accessible by gaining
access from Blade Operative Paulina (after Salma is Queen) in the Sanctum
Cay outpost.

Here is my site guild wars 2 guide halloween

Anonymous said...

smokeless cigarettes, e cigarette forum, electronic cigarette, best e cigarette, electronic cigarettes, best electronic cigarettes