Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3354890
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T02:19:44+00:00 2026-05-18T02:19:44+00:00

I have an application that reads emails from ONE email account (gmail application account)

  • 0

I have an application that reads emails from ONE email account (gmail application account) but this account has many aliases x@domain.com y@domain.com and x@domain.com they all email MAIN@domain.com

I have set up a java application to read mails from MAIN@domain.com but depending on the alias it should reply to the email from the alias and not show the main email everything is being forwarded to.

everytime I test it ignores the from alias and just sends from MAIN@domain.com

how can I change this ?!

the code

String SMTP_HOST_NAME = “smtp.gmail.com”;

        Properties props = new Properties();
        props.put("mail.smtps.host", SMTP_HOST_NAME);
        props.put("mail.smtps.auth", "false");

        Session mailSession = Session.getInstance(props);
        try {

            MimeMessage message = new MimeMessage(mailSession);
            message.setFrom(new InternetAddress(AliasEmail));
            message.addRecipient(Message.RecipientType.TO,
                new InternetAddress(email + carrier));

            message.setSubject(FileUtils.readFileToString(new File(Alias
                + "-confirm-subject.txt")));

            message.setText(FileUtils.readFileToString(new File(Alias + "-confirm.txt")),
                "text/plain");

            message.setContent(FileUtils.readFileToString(new File(Alias + "-confirm.html")),
                "text/html");

            Transport transport = mailSession.getTransport("smtps");


            transport.connect(SMTP_HOST_NAME, MAINuser, MAINpassword);


            transport.sendMessage(message, message.getRecipients(Message.RecipientType.TO));
            transport.close();

            logger.info("Email Confirmation Sent  = [" + Alias + carrier + "]");

thank you in advance

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-18T02:19:44+00:00Added an answer on May 18, 2026 at 2:19 am

    It is very likely that Gmail won’t let you send e-mail from any address you choose (this is how it is in the normal web interface, so I’d expect that’s how it is in the SMTP interfaces as well). You may have no solution but to use another mail server for outgoing e-mails. Registering the alternate addresses as your own in Gmail’s settings might work, too.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an application that reads a table from a database. I issue an
I have an application that reads lines from a file and runs its magic
I have a MVC application that reads some data from a database and loads
I have an implementation that just like gmail application, but have met some problem
I have an application that reads/writes from/to message queues on remote application servers. The
I have an application that reads a CSV file with piles of data rows.
I have an application that reads a database and outputs alerts to any dependencies
I have a basic C# console application that reads a text file (CSV format)
Hy, I have an application that sends mails with Gmail SMTP server (smtp.gmail.com) using
I have a JBOSS batch application that sometimes sends hundreds on emails in a

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.