javax.mail not including Sender Name in emails

No matter what I try, I can't get the Sender Name to show up in the outgoing mails sent through the javax.mail Session class.

Please note that I'm using Rhino so there's a mixture of javascript and java here, but the code problem exists in pure java as well.

var _java = JavaImporter(javax.mail, javax.mail.internet, java.util);

        var props = new _java.Properties();
        props.put("", myHost);
        props.put("mail.smtp.port", "465");
        props.put("mail.smtp.user", myUserName);
        props.put("mail.smtp.auth", "true");
        props.put("mail.smtp.socketFactory.port", 465);
        props.put("mail.smtp.socketFactory.fallback", "false");
        props.put("mail.smtp.ssl", "true");

        var session = _java.Session.getInstance(props);

        var message = _java.MimeMessage(session);
            new _java.InternetAddress("myEmailAddress", "My Full Name")
            [new _java.InternetAddress("", true)]
        message.setSentDate(new Date());
        var t = session.getTransport("smtp");
        t.connect(myUserName, myPassword);
        t.sendMessage(message, message.getAllRecipients());

The email that comes through has:

Sender: Personal Name <>

But the from is always:


Therefore, mail clients like Outlook and Gmail aren't plucking out the name.

I've tried adding

props.put("mail.smtp.from", "Full Name <>")

but this doesn't make any difference.

Anybody have any experience with this bug?



What a pain.

The bug was that I was using message.setSender instead of message.setFrom.

Changing that solved it.

Need Your Help

performSelector:withObject:afterDelay: not queuing selector

ios objective-c grand-central-dispatch nsrunloop

I've setup a block to run on a different queue and call another method after a delay:

Passing int array to fragment shader

arrays opengl-es glsl fragment-shader

I'm attempting to plot an iterative function in OpenGL ES. An array of ints is being updated with how often a given pixel is hit by the iterative function. I'd like to pass this density array to a

Duck type as syntactic sugar for reflection: Good or bad idea?

refactoring language-design syntactic-sugar duck-typing

I've been thinking lately, would it be a good form of syntactic sugar in languages like Java and C#, to include a "duck" type as a method parameter type? This would look as follows:

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.