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 618611
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T18:33:55+00:00 2026-05-13T18:33:55+00:00

I have the below mail program. The problem is mail program runs successfully but

  • 0

I have the below mail program. The problem is mail program runs successfully but it doesn’t send me the emails. The logs say it’s mailed successfully. Not sure what might be the problem. Do i need to change the Java Program?

I have the below values set in the application.properties file and these values get read from the program and passed as vector to the send function

mail.smtp.host=excha.testing.com
mail.smtp.techEmail="test1@test.com"
mail.smtp.toEmail="test2@test.com"
mail.smtp.fromEmail=test_systems@test.com
mail.smtp.fromName=Testing test Systems
mailHandler.send(mailingAddress,ccEmailAddress,fromEmailAddress,fromEmailAlias,envName + "::" + " Process", exitMessage + " - " + message))

———————–Mail Send Program code pasted below———

public synchronized boolean send(Vector eMailAddress, Vector ccEmailAddress, String 
fromEmailAddress, String fromEmailAlias, String messageSubject, String messageText)
  {



    try
    {
      Message msg = new MimeMessage(session);
      msg.setSubject(messageSubject);
      msg.setText(messageText);

      InternetAddress addresses[] = new InternetAddress[eMailAddress.size()];
      for (int i = 0; i < eMailAddress.size(); i++ ) {
        addresses[i] = new InternetAddress((String)(eMailAddress.elementAt(i)));
 }
      msg.setRecipients(Message.RecipientType.TO, addresses);

      InternetAddress ccAddresses[] = new InternetAddress[ccEmailAddress.size()];
      for (int i = 0; i < ccEmailAddress.size(); i++ ) {
        ccAddresses[i] = new InternetAddress((String)(ccEmailAddress.elementAt(i)));
 }
      msg.setRecipients(Message.RecipientType.CC, ccAddresses);

      if ((null != fromEmailAddress) && (null != fromEmailAlias))
      {
       msg.setFrom(new InternetAddress(fromEmailAddress, fromEmailAlias));
      } 
      else if ((null != fromEmailAddress) && (null == fromEmailAlias))
      {
       msg.setFrom(new InternetAddress(fromEmailAddress));
      }
      else if ((null == fromEmailAddress) && (null == fromEmailAlias))
      {
       String smtpFromEmail
            = (ApplicationProperties.getApplicationProperties()).getProperty(SMTP_FROM_EMAIL_KEY);
       String smtpFromName
            = (ApplicationProperties.getApplicationProperties()).getProperty(SMTP_FROM_NAME_KEY);
       if (null == smtpFromEmail || "".equals(smtpFromEmail))
       {
         smtpFromEmail = SENDER_EMAIL;
       }
       if (null == smtpFromName || "".equals(smtpFromName))
       {
         smtpFromName = SENDER_NAME;
       }
       msg.setFrom(new InternetAddress(smtpFromEmail, smtpFromName));
      }

      Transport.send(msg);
      cat.debug("Sent message to " + eMailAddress);
      return true;
    } catch (Exception e)
    {
      cat.error("Error sending email", e);
      return false;
    }
  }
  • 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-13T18:33:55+00:00Added an answer on May 13, 2026 at 6:33 pm

    To send mail with Java Mail you need a valid SMTP server and an account in that server.

    I’m assuming that the server at excha.testing.com is just swallowing anything you send to it, otherwise I’m failing to see a reason for your program not to work.

    Cheers.

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

Sidebar

Related Questions

i have a problem with the code below. the mail is sent with a
I have two servers. One (linux) will send mail fine using the script below.
I want to style mail body. I have tried the below methods to style
I have a small script which im using to test PHP mail(), as below:
I have below code: class Program { static void Main(string[] args) { Task[] tasks
I have a third party program which basically allows users to send email and
I want to send mail from my custom iPhone app. I have used MFMailComposeViewController
I have a form like below on my index page: <form action=send.php method=POST> <b>Your
I use the code below to send an e-mail to may e-mail address. When
How to send a mail through mvc-3 asp.net using c#? I have to send

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.