openlang

Making the sender appear as a label instead of an email address using Java Mail

Im sending messages through the Java Mail API. On arrival, the inbox displays the address that sent the message. Id like some text to appear in place of that sender address. This seems possible because messages I receive from facebook show "Facebook - Message title" in the inbox instead of "mailbox@facebook.com - Message Title".

I'd like that same behaviour with the Java Mail API.

Thank you beforehand. :)

The conversation continues 2

Follow the reasoning
  1. Permalink

    Choose this Constructor

    InternetAddress(String address, String personal)

    while creating the sender address. Your example would become

    originator = new InternetAddress("mailbox@facebook.com", "Facebook");
  2. Permalink

    Put this code within your try block:

    // Sender:
    mail.setFrom(new InternetAddress("displayname<"+origin + ">"));

Other sides of the same question

  1. Dynamics CRM access from TypeScript

    Because my CRM code runs in a webresource, I have to write to retrieve the entity's data. Regrettably, that expression fails…

    Replies 2Latest activity typescript
  2. What date formatting does a Gleam HTTP response header need?

    I want to send a Date header. The required format looks like this: This is my current attempt:

    Replies 3Latest activity gleam
  3. Fastest approach for filling a Mat region with zero using OpenCV C++?

    What would be the most efficient approach for filling one area within a grayscale Mat image with zeros (or, indeed, with anot…

    Replies 3Latest activity cpp