Getting exception in sending mail

hi i got the exception as
javax.mail.MessagingException: 530 5.7.0 Must issue a STARTTLS command first m78sm938871pye
eventhoug i tryed all the suggestion specified in the forum. But still i got this problem can any one send the sulution for me its urgent for me
Thanks In Advance
[email protected]

Here i send the code but it gives starttls exception can any one help me to solve this
import javax.mail.*;
import javax.mail.internet.*;
import java.util.*;
import java.io.*;
public class SendMailUsingAuthentication
private static final String SMTP_HOST_NAME = "smtp.gmail.com";
private static final String SMTP_AUTH_USER = "vsrmca06";
private static final String SMTP_AUTH_PWD = "xxxxx";
private static final String emailMsgTxt = "Online Order Confirmation Message. Also include the Tracking Number.";
private static final String emailSubjectTxt = "Order Confirmation Subject";
private static final String emailFromAddress = "[email protected]";
// Add List of Email address to who email needs to be sent to
private static final String[] emailList = {"[email protected]"};
public static void main(String args[]) throws Exception
SendMailUsingAuthentication smtpMailSender = new SendMailUsingAuthentication();
smtpMailSender.postMail( emailList, emailSubjectTxt, emailMsgTxt, emailFromAddress);
System.out.println("Sucessfully Sent mail to All Users");
public void postMail( String recipients[ ], String subject,
String message , String from) throws MessagingException
boolean debug = true;
//Set the host smtp address
java.security.Security.addProvider(new com.sun.net.ssl.internal.ssl.Provider());
Properties props = new Properties();
props.put("mail.transport.protocol", "smtp");
props.put("mail.smtp.starttls","true");
props.put("mail.smtp.port",465);
props.put("mail.smtp.host", SMTP_HOST_NAME);
props.put("mail.smtp.auth", "true");
Authenticator auth = new SMTPAuthenticator();
Session session = Session.getDefaultInstance(props, auth);
session.setDebug(debug);
// create a message
Message msg = new MimeMessage(session);
// set the from and to address
InternetAddress addressFrom = new InternetAddress(from);
msg.setFrom(addressFrom);
InternetAddress[] addressTo = new InternetAddress[recipients.length];
for (int i = 0; i < recipients.length; i++)
addressTo[i] = new InternetAddress(recipients);
msg.setRecipients(Message.RecipientType.TO, addressTo);
// Setting the Subject and Content Type
msg.setSubject(subject);
msg.setContent(message, "text/plain");
Transport.send(msg);
* SimpleAuthenticator is used to do simple authentication
* when the SMTP server requires it.
private class SMTPAuthenticator extends javax.mail.Authenticator
public PasswordAuthentication getPasswordAuthentication()
String username = SMTP_AUTH_USER;
String password = SMTP_AUTH_PWD;
return new PasswordAuthentication(username, password);

Similar Messages

  • Getting exceptions while sending mail using javamail api

    Hi to all
    I am developing an application of sending a mail using JavaMail api. My program is below:
    quote:
    import javax.mail.*;
    import javax.mail.internet.*;
    import java.util.*;
    public class sms
    public static void main(String args[])
    try
    String strstrsmtserver="smtp.bol.net.in";
    String strto="[email protected]";
    String strfrom="[email protected]";
    String strsubject="Hello";
    String bodytext="This is my first java mail program";
    sms s=new sms();
    s.send(strstrsmtserver,strto,strfrom,strsubject,bodytext);
    catch(Exception e)
    System.out.println("usage:java sms"+"strstrsmtpserver tosddress fromaddress subjecttext bodyText");
    System.exit(0);
    public void send(String strsmtpserver,String strto,String strfrom ,String strsubject,String bodytext)
    try
    java.security.Security.addProvider(new com.sun.net.ssl.internal.ssl.Provider());
    Properties p=new Properties(System.getProperties());
    if(strsmtpserver!=null)
    p.put("mail.transport.protocol","smtp");
    p.put("mail.smtp.host","[email protected]");
    p.put("mail.smtp.port","25");
    Session session=Session.getDefaultInstance(p);
    Message msg=new MimeMessage(session);
    Transport trans = session.getTransport("smtp");
    trans.connect("smtp.bol.net.in","[email protected]","1234563757");
    msg.setFrom(new InternetAddress(strfrom));
    msg.setRecipients(Message.RecipientType.TO,InternetAddress.parse(strto,false));
    msg.setSubject(strsubject);
    msg.setText(bodytext);
    msg.setHeader("X-Mailer","mtnlmail");
    msg.setSentDate(new Date());
    Transport.send(msg);
    System.out.println("Message sent OK.");
    catch(Exception ex)
    System.out.println("here is error");
    ex.printStackTrace();
    It compiles fine but showing exceptions at run time.Please help me to remove these exceptions.I am new to this JavaMail and it is my first program of javamail.Please also tell me how to use smtp server.I am using MTNL 's internet connection having smtp.bol.net.in server.
    exceptions are:
    Here is exception
    quote:
    Javax.mail.MessagingException:Could not connect to SMTP host : smtp.bol.net.in, port :25;
    Nested exception is :
    Java.net.ConnectException:Connection refused: connect
    At com.sun.mail.smtp.SMTPTransport.openServer<SMTPTransport.java:1227>
    At com.sun.mail.smtp.SMTPTransport.protocolConnect<SMTPTransport.java:322>
    At javax.mail.Service .connect(Service.java:236>
    At javax.mail.Service.connect<Service.java:137>
    At sms.send<sms.java:77>
    At sms.main<sms.java:24>

    Did you find the JavaMail FAQ?
    You should talk to your ISP to get the details for connecting to your server.
    In this case I suspect your server wants you to make the connection on the
    secure port. The FAQ has examples of how to do this for GMail and Yahoo
    mail, which work similarly. By changing the host name, these same examples
    will likely work for you.

  • Exception in Sending Mails - Must issue a STARTTLS

    Sending Mails to Multiple Users
    I m getting this error, can somebody tell me what could be the possible error here:
    530 5.7.0 Must issue a STARTTLS command first k39sm4421196wah
    com.sun.mail.smtp.SMTPSendFailedException: 530 5.7.0 Must issue a STARTTLS command first k39sm4421196wah
    at com.sun.mail.smtp.SMTPTransport.issueSendCommand(SMTPTransport.java:1388)
    at com.sun.mail.smtp.SMTPTransport.mailFrom(SMTPTransport.java:959)
    at com.sun.mail.smtp.SMTPTransport.sendMessage(SMTPTransport.java:583)
    at MailSender.sendMessageTo(MailSender.java:46)
    at Mailer.sendMessages(Mailer.java:19)
    at Mailer.main(Mailer.java:33)
    Exception in thread "main" com.sun.mail.smtp.SMTPSendFailedException: 530 5.7.0 Must issue a STARTTLS command first k39sm44211
    96wah
    at com.sun.mail.smtp.SMTPTransport.issueSendCommand(SMTPTransport.java:1388)
    at com.sun.mail.smtp.SMTPTransport.mailFrom(SMTPTransport.java:959)
    at com.sun.mail.smtp.SMTPTransport.sendMessage(SMTPTransport.java:583)
    at MailSender.sendMessageTo(MailSender.java:46)
    at Mailer.sendMessages(Mailer.java:19)
    at Mailer.main(Mailer.java:33)

    Your server wants you to issue a STARTTLS command to switch the
    socket to a secure connection. You can allow JavaMail to do that by
    setting the "mail.smtp.starttls.enable" property to "true" when you create
    the Session. See the SSLNOTES.txt file included with JavaMail and the
    com.sun.mail.smtp package javadocs.

  • Geting exception whiel sending mail from OIM

    Hi,
    Currently we are using Exchange 2010 and our OIM version is 9.1.0. We have written custom code for Exchange provisioning. We have migrated the admin account, through which OIM sends out mail, to Exchange 2010. We are trying to create new OIM user in IDM. We have a custom code which sends out mail to supervisor when a new contractor is created in IDM. Whiel sending mail from that admin account to supervsior we get this below error:
    ERROR,08 Nov 2012 00:03:28,026,[XELLERATE.REQUESTS],Class/Method: tcEmailNotificationUtil/sendEmail encounter some problems: Sending failed;
    nested exception is:
    class javax.mail.MessagingException: xxx x.x.x Client was not authenticated
    javax.mail.SendFailedException: Sending failed;
    nested exception is:
    class javax.mail.MessagingException: xxx x.x.x Client was not authenticated
    at javax.mail.Transport.send0(Transport.java:218)
    at javax.mail.Transport.send(Transport.java:80)
    at com.thortech.xl.dataobj.util.tcEmailNotificationUtil.sendEmail(Unknown Source)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:585)
    Please help us on this. Is firewall a issue as exchange server is installed on some other remote server?
    Thanks.
    Edited by: user11957197 on 8 Nov, 2012 1:15 AM

    I resolved this issue by using tcEmailNotificationUtil instead of other API
    In the Adapter's Java Code, I read values from "Email Server" IT Resource and my custom Email Template definition...by using tcITResourceOperationsIntf and tcEmailDefinitionOperationsIntf)
    Then by using OOTB class found in mail.jar and xlDataObjects.jar, I sent the mail..
    By using OOTB class found in mail.jar and xlDataObjects.jar, I sent the mail..
    import com.thortech.xl.dataobj.util.tcEmailNotificationUtil;
    tcEmailNotificationUtil emailNotificationUtil = new tcEmailNotificationUtil(dataProvider);
    emailNotificationUtil.constructEmail(emailTemplateName);
    emailNotificationUtil.sendEmail(toEmailAddress);

  • HT1766 I just restored my old iphone data to my new phone. When I tried to send an email, it kept asking me for my email password. I couldn't remember it and kept trying over and over. Now email wont send and I keep getting a Cannot Send Mail:

    I restored my phone data onto my new phone. When I tried to send email it asked me for my email password, which I couldn't remember. Now I keep getting an error message whenever I try to send an email. How do I reset this so it works?

    Until you can enter that password it kept asking for, you won't be able to send mail. You need to go to Settings>Mail, Contacts, Calendars>Email Account you are referring to>SMTP server, and make changes there. If you cannot remember your email password, you will have to get in touch with your provider to be able to change it.

  • Getting message cannot send mail check server setting

    Trying to get email to send out, but getting a message saying cannot send...check outgoing server setting...
    Anybody???
    Penni

    Do you have any other mail accounts on your iPad? If so you can select another server from the options.
    Go to settings again and select Mail, Contacts, Calendars. Then select your mail account from the window on the right side. Then tap on the email address of the account to open the next window that shows the account information. Then there should be heading titled Outgoing Mail Server. You can tap the arrow to the right of the server name in that field to get to the next window that shows other servers. Try to select one from there and see if that works.
    I keep forgetting about this as well. It has provided help to others.
    http://mail.google.com/support/bin/answer.py?answer=77702
    Message was edited by: Demo

  • Unknown exception in sending mail

    Hi,
    I have written a jsp send mail application, but it is giving error that NoSuchProviderException. What to do? Plz help. I m sending the code as below:
    <%@ page import="java.util.*, javax.mail.*,javax.mail.internet.*" %>
    <html>
    <head>
    <title>E-Mail Us</title>
    </head>
    <body bgcolor="white" text="#003399" >
    <%
    if(request.getMethod().equals("POST") )
    boolean status = true;
    String mailServer ="SMTP_HOST";
    String fnm = request.getParameter("fnm");
    String lnm = request.getParameter("lnm");
    String facility = request.getParameter("facility");
    String subject = request.getParameter("select");
    String fromEmail = "[email protected]";
    String toEmail = "[email protected]";
    String bccEmail = "[email protected]";
    String contact =request.getParameter("select2");
    String way =request.getParameter("way");
    String messageEnter = request.getParameter("message");
    try
    Properties props = new Properties();
    props.put("mail.smtp.host", mailServer);
    props.put("mail.smtp.auth", "true");
    Session s = Session.getInstance(props,null);
    MimeMessage message = new MimeMessage(s);
    InternetAddress from = new InternetAddress(fromEmail);
    message.setFrom(from);
    InternetAddress to = new InternetAddress(toEmail);
    InternetAddress bcc = new InternetAddress(bccEmail);
    message.addRecipient(Message.RecipientType.TO, to);
    message.addRecipient(Message.RecipientType.BCC, bcc);
    message.setSubject(subject);
    message.setSentDate(new Date());
    message.setText(messageEnter);
    message.setText(way);
    message.setText(contact);
    message.setText(facility);
    message.setText(fnm);
    message.setText(lnm);
    Transport transport = s.getTransport(mailServer);
    transport.connect(mailServer, "USER", "PASSWORD");
    transport.sendMessage(message, message.getAllRecipients());
    transport.close();
    catch(NullPointerException n)
    System.out.println(n.getMessage() );
    out.println(n.getMessage());
    out.println("<br><br><br><br><center><b>"+" ERROR!!!"+"</b></center>");//you need to enter a message"+"</b></center>");
    out.println("<br><br><center><b>"+"You need to Enter a message"+"</b></center>");
    status = false;
    catch (Exception e)
    System.out.println(e.getMessage() );
    out.println("<br><br><br><br><center><b>"+" ERROR!!!"+"</b></center>");
    out.println("<br><br><center><b>"+"Your Message to " + toEmail +" and "+ bccEmail+ " failed, reason is: " + e);
    status = false;
    if (status == true)
    out.println("<br><br><center><b>"+"Your message to " + toEmail +" and "+ bccEmail+ " was sent successfully!"+"</b></center>");
    else
    %>
    <center>
    <h1>Contact Us</h1>
    <form method="post" name="mail" action="mail.jsp">
    <table border="0">
    <tr>
    <td><b>First Name :</b></td>
    <td><input type="text" name="fnm" size=24></td>
    </tr>
    <tr>
    <td><b>Last Name :</b></td>
    <td><input type="text" name="lnm" size=24></td>
    </tr>
    <tr>
    <td><b>Facility :</b></td>
    <td><input type="text" name="facility" size=24></td>
    </tr>
    <tr>
    <td><b>Subject :</b></td>
    <td> <select name="select">
    <option>-------------------------------</option>
    <option>Missing File</option>
    <option>Correction Issue</option>
    <option>Refer Us</option>
    <option>Miscellaneous</option>
    </select></td>
    </tr>
    <p>
    <tr>
    <td><b>Comments :</b></td>
    <td><textarea name="message" rows = "10" cols="50"></textarea></td>
    </tr>
    <tr>
    <td><b>Best way to contact :</b></td>
    <td>
    <select name="select2">
    <option>--------------</option>
    <option>Phone</option>
    <option>Email</option>
    <option>Fax</option>
    </select>
    <input type="text" name="way" size=24></td>
    </tr>
    </table>
    <p>
    <font face="Helvetica"><input type="submit"
    value="Submit" name="Command">
    </font>
    </form></center>
    <%
    %>
    </body>
    </html>unk

    Hi,
    Have you configured the SMTP server settings in the various config files for the new version that you are using? Your log seems to suggest that it is still set to 'mail' which I think is the default.
    I think the minimum you need to do is Essbase, Financial Reporting and Workspace, files as detailed below (paths may vary depending upon platform, windows & tomcat provided below even though it sounds like you've done this before).
    Essbase: C:\Hyperion\AnalyticAdministrationServices\server\ OlapAdmin.properties
    Financial Reporting: C:\Hyperion\BIPlus\lib\ fr_global.properties
    Workspace: log in and select Navigate > Administer > Notifications
    You may also need to restart the related services.
    Hope this helps
    Stuart Game
    www.analitica.co.uk

  • Getting error while sending mail through javamail api

    I can able to compile the following code successfully but while executing it showing the error
    C:\Program Files\Java\javamail-1.4\demo>java msgsend -o [email protected] -M 203.112.158.188 [email protected]
    Exception in thread "main" java.lang.NoClassDefFoundError: msgsend
    import java.io.*;
    import java.net.InetAddress;
    import java.util.Properties;
    import java.util.Date;
    import javax.mail.*;
    import javax.mail.internet.*;
    public class msgsend {
    public static void main(String[] argv) {
         String to, subject = null, from = null,
              cc = null, bcc = null, url = null;
         String mailhost = "null";
         String mailer = "msgsend";
         String file = null;
         String protocol = null, host = null, user = null, password = null;
         String record = null;     // name of folder in which to record mail
         boolean debug = false;
         BufferedReader in =
                   new BufferedReader(new InputStreamReader(System.in));
         int optind;
         for (optind = 0; optind < argv.length; optind++) {
         if (argv[optind].equals("-T")) {
              protocol = argv[++optind];
         } else if (argv[optind].equals("-H")) {
              host = argv[++optind];
         } else if (argv[optind].equals("-U")) {
              user = argv[++optind];
         } else if (argv[optind].equals("-P")) {
              password = argv[++optind];
         } else if (argv[optind].equals("-M")) {
              mailhost = argv[++optind];
         } else if (argv[optind].equals("-f")) {
              record = argv[++optind];
         } else if (argv[optind].equals("-a")) {
              file = argv[++optind];
         } else if (argv[optind].equals("-s")) {
              subject = argv[++optind];
         } else if (argv[optind].equals("-o")) { // originator
              from = argv[++optind];
         } else if (argv[optind].equals("-c")) {
              cc = argv[++optind];
         } else if (argv[optind].equals("-b")) {
              bcc = argv[++optind];
         } else if (argv[optind].equals("-L")) {
              url = argv[++optind];
         } else if (argv[optind].equals("-d")) {
              debug = true;
         } else if (argv[optind].equals("--")) {
              optind++;
              break;
         } else if (argv[optind].startsWith("-")) {
              System.out.println(
    "Usage: msgsend [[-L store-url] | [-T prot] [-H host] [-U user] [-P passwd]]");
              System.out.println(
    "\t[-s subject] [-o from-address] [-c cc-addresses] [-b bcc-addresses]");
              System.out.println(
    "\t[-f record-mailbox] [-M transport-host] [-a attach-file] [-d] [address]");
              System.exit(1);
         } else {
              break;
         try {
         if (optind < argv.length) {
              // XXX - concatenate all remaining arguments
              to = argv[optind];
              System.out.println("To: " + to);
         } else {
              System.out.print("To: ");
              System.out.flush();
              to = in.readLine();
         if (subject == null) {
              System.out.print("Subject: ");
              System.out.flush();
              subject = in.readLine();
         } else {
              System.out.println("Subject: " + subject);
         Properties props = System.getProperties();
         // XXX - could use Session.getTransport() and Transport.connect()
         // XXX - assume we're using SMTP
         if (mailhost != null)
              props.put("mail.smtp.host", mailhost);
         // Get a Session object
         Session session = Session.getInstance(props, null);
         if (debug)
              session.setDebug(true);
         // construct the message
         Message msg = new MimeMessage(session);
         if (from != null)
              msg.setFrom(new InternetAddress(from));
         else
              msg.setFrom();
         msg.setRecipients(Message.RecipientType.TO,
                             InternetAddress.parse(to, false));
         if (cc != null)
              msg.setRecipients(Message.RecipientType.CC,
                             InternetAddress.parse(cc, false));
         if (bcc != null)
              msg.setRecipients(Message.RecipientType.BCC,
                             InternetAddress.parse(bcc, false));
         msg.setSubject(subject);
         String text = collect(in);
         if (file != null) {
              // Attach the specified file.
              // We need a multipart message to hold the attachment.
              MimeBodyPart mbp1 = new MimeBodyPart();
              mbp1.setText(text);
              MimeBodyPart mbp2 = new MimeBodyPart();
              mbp2.attachFile(file);
              MimeMultipart mp = new MimeMultipart();
              mp.addBodyPart(mbp1);
              mp.addBodyPart(mbp2);
              msg.setContent(mp);
         } else {
              // If the desired charset is known, you can use
              // setText(text, charset)
              msg.setText(text);
         msg.setHeader("X-Mailer", mailer);
         msg.setSentDate(new Date());
         // send the thing off
         Transport.send(msg);
         System.out.println("\nMail was sent successfully.");
         // Keep a copy, if requested.
         if (record != null) {
              // Get a Store object
              Store store = null;
              if (url != null) {
              URLName urln = new URLName(url);
              store = session.getStore(urln);
              store.connect();
              } else {
              if (protocol != null)          
                   store = session.getStore(protocol);
              else
                   store = session.getStore();
              // Connect
              if (host != null || user != null || password != null)
                   store.connect(host, user, password);
              else
                   store.connect();
              // Get record Folder. Create if it does not exist.
              Folder folder = store.getFolder(record);
              if (folder == null) {
              System.err.println("Can't get record folder.");
              System.exit(1);
              if (!folder.exists())
              folder.create(Folder.HOLDS_MESSAGES);
              Message[] msgs = new Message[1];
              msgs[0] = msg;
              folder.appendMessages(msgs);
              System.out.println("Mail was recorded successfully.");
         } catch (Exception e) {
         e.printStackTrace();
    public static String collect(BufferedReader in) throws IOException {
         String line;
         StringBuffer sb = new StringBuffer();
         while ((line = in.readLine()) != null) {
         sb.append(line);
         sb.append("\n");
         return sb.toString();
    So please help me to resolve that error.

    The directory that contains msgsend.class (usually the current directory)
    is not in your CLASSPATH setting. Be sure that "." is included as one of the
    entries in CLASSPATH.

  • Exception while sending mail using javamail

    below i am using the code to send a mail to [email protected]
    but it is giving exception
    "class com.sun.mail.smtp.SMTPSendFailedException: 554 <[email protected]>: Recipient address rejected: Relay access denied"
    please can any body help me to solve this problem
    Properties props = new Properties();
    props.put("mail.smtp.host", "xxxxxxxxxxxxx");
    Session s = Session.getInstance(props,null);
    MimeMessage message = new MimeMessage(s);
    InternetAddress from = new InternetAddress("[email protected]");
    message.setFrom(from);
    InternetAddress to = new InternetAddress("[email protected]");
    message.addRecipient(Message.RecipientType.TO, to);
    message.setSubject("Test from JavaMail.");
    message.setText("Hello from JavaMail!");
    Transport.send(message);

    I was getting the same error as the others, and I added authentication, but it still gives me the error.
    All "AutomailingUtility" constants are strings
    public class SMTPSender {
    private Session session;
    public SMTPSender() {
    Properties props = new Properties();
    props.setProperty("mail.smtp.host", AutomailingUtility.HOST);
    props.put("mail.smtp.auth", AutomailingUtility.AUTH);
    Authenticator auth = new MyAuthenticator(AutomailingUtility.USERNAME, AutomailingUtility.PASSWORD);
    session = Session.getInstance(props, auth);
    public void sendMessage(String toUser, String message, String subject) {
    try {
    Message msg = new MimeMessage(session);
    msg.setSubject(subject);
    msg.setSentDate(new Date());
    InternetAddress ia = new InternetAddress(AutomailingUtility.FROM_ADDRESS);
    msg.setFrom(ia);
    msg.setRecipients(Message.RecipientType.TO, InternetAddress.parse(toUser));
    msg.setText(message);
    Transport.send(msg);
    } catch (AddressException e) {
    e.printStackTrace();
    } catch (MessagingException e) {
    e.printStackTrace();
    any ideas?

  • Getting erroe when Sending mail through Javamail

    I am a new Java Programmer
    I am getting the followoing error message
    javax.mail.sendFailedException: sending failed;
    javax.mail.MessagingException:
    Could not connect SMTP host: aol.com,
    port: 25;
    nested exception is:
    java.net.SocketException: connect (code=10060)
    at javax.mail.Transport.send0(transport.jave:219)
    at javax.mail.Transport.send(transport.jave:81)
    at msgsend<init>(msgsend.java, compiled code;)
    at msgsend.main(msgsend.java:52)
    Please help me
    thank you in advance

    I would try to telnet to the SMTP host first from your OS, to check that you have the correct host and port.
    The AOL SMTP server may be blocked by a firewall, if you are not on a dial-up connection to AOL.
    try:
    telnet aol.com 25
    You should get ' connecting to aol.com...'
    1-----------------------------------------------------
    and if the SMTP server is accepting connections you will get.. somthing like..
    Connecting to aol.com
    220 aol.com ESMTP Server (Microsoft Exchange Internet Mail Service 5.5.2653.13) ready
    type 'HELO' and hit return, it will not apear on the screen you shoud get 'OK'
    2-----------------------------------------------------
    if NOT you will get something like
    Connecting To aol.com...Could not open a connection to host on port 25 : Connect failed
    Hope this helps, Best Regards Gareth

  • Exception when sending mail to client on a different mail server

    Hi,
    When i try to send a mail to a client on a different mail server from mine I am getting the following exception.
    javax.mail.SendFailedException: Sending failed;
    nested exception is:
         class javax.mail.SendFailedException: Invalid Addresses;
    nested exception is:
         class javax.mail.SendFailedException: 550 not local host yahoo.com, not a gateway
    It works perfectly fine when i send a mail to a client on my mail server. I am stuck up at this point - PLEASE HELP, any help greatly appreciated.
    Thank you,
    npaila

    Most of these are, of course, anti-Spam measures implemented by the various SMTP hosts, to prevent spammers from using their servers to spread the stuff (what you're doing is exactly what Spammers do as well).
    In general, most properly configured SMTP servers will only accept messages if:
    (a) Your IP address (as seen by that SMTP server) maps back to a proper host name, AND
    (b) The recipient of the message is "local" as determined by that SMTP server, AND
    (c) In many cases, the SMTP server will also cross-check your HELO/EHLO address and the MAIL FROM: value.
    It may take a few attempts to get all this right.

  • Exception while sending Mail

    Hi I am getting javax.mail.sendFailedException: InvalidAddreses
    nested exception is class com.sun.mail.smtp.SMTPAddressFailedException:553 sorry that domain isn't in my list of allowed rcpthosts<#5.7.1>
    Here my Program:
    package com.fortune2win.mail;
    import java.util.*;
    import javax.mail.*;
    import javax.mail.internet.*;
    import javax.activation.*;
    // Send a simple, single part, text/plain e-mail
    public class SendMail {
    public void sendMail(String TO,String secCode, String UserNumber){
                                                                          // SUBSTITUTE YOUR EMAIL ADDRESSES HERE!!!
    String from = "[email protected]";
                                                                          // SUBSTITUTE YOUR ISP'S MAIL SERVER HERE!!!
    String host = "207.234.145.236";
                                                                          // Create properties, get Session
    Properties props = new Properties();
              props.put("mail.transport.protocol","smtp");
                                                                          // If using static Transport.send(),
                                                                          // need to specify which host to send it to
    props.put("mail.smtp.host", host);
                                                                               // To see what is going on behind the scene
    props.put("mail.debug", "true");
    Session session = Session.getDefaultInstance(props);
    try {
                                                                               // Instantiatee a message
    Message msg = new MimeMessage(session);
                                                                               //Set message attributes
    InternetAddress addressFrom = new InternetAddress(from);
              msg.setFrom(addressFrom);
                   InternetAddress[] address = {new InternetAddress(TO)};
                   msg.setRecipients(Message.RecipientType.TO,address);
    msg.setSubject("F2W Player's Intimation");
                                                                               // Set message content
    msg.setText("Thank You for playing F2W online game.\n \n"+
    "CONGRATULATIONS\n \n "+
    "Your Number:" UserNumber""+"is a valid entry. \n"+
    "Your Security Code:"+""+secCode+""+"\n" +
    "You are entitled to claim the prize only if you produce a print of this mail."+
    "\n Click www.fortune2win.com/home_index.jsp for prizedetails.\n");
                                                                               //Send the message
    Transport.send(msg);
    catch (MessagingException mex) {
                                                                               // Prints all nested (chained) exceptions as well
    mex.printStackTrace();
                                                                                    //End of class
    Plz it urgent...Help me

    Hi thanks for the reply.
    But the TO addreass I specified in the argumentlist. that is outside the program.
    But the mails are going to with in the same host that is under given host address(XXX.XXX.XXX.XXX) .
    Wht I mean is..mails are going with in my company...but outside mails are not going...like yahoo/gmail..etc..
    plz help .
    TO address i am taking from Form textbox
    Regards
    Varma

  • Exception in Sender mail module

    Hello
    We have developed a mail module but we´re facing some problems. The module only process the first mail message. After the second "run", it throws the exception:
    exception caught during processing mail message[1]; com.sap.aii.af.mp.processor.ModuleProcessorException: Error during processing local bean: localejbs/MyModule caused by: com.sap.engine.services.ejb.exceptions.BaseEJBException: Exception in method process.
    The module starts working again only by restarting java stack on scmicm. Even if I stop and start the Communication Channel on Rwb, it doesnt work.
    Any ideas?
    Thanks!

    Actually I just noticed I´m using DocumentBuilderFactory.newInstance() static class.
    I checked the traces and the error is exactly on that line.
    But I dont know how to deal with it.

  • Getting EOP to send mail to On premises Exchange 2013

    one of may clients has Office 365 Enterprise E1 for Nonprofits and on premise exchange 2013 server which I'm trying to implement the EOP service.
    but i cannot get the exchange online outbound connector to forward on the emails to the on premise server.
    i have active directory sync working.
    i.e when i add a new user on premises it creates it online.
    could anybody let me know how to get this service to work.
    what i would like is
    1 mx record to point to eop service and collect and filter email.
    (which i have done by adding mx records as per dns instructions. checks show as fine.but changed back to on premises server because emails where only staying in online inbox. the on premises domain name has been setup within office 365 as default domain and
    in accepted domains within exchange online.both exchange online and on premises default domain name our the same.)
    2 filter mail to be forwarded to correct mail box to on premises server.
    ( which i have setup outbound connector with exchange online to point to our on premises exchange server but does not receive any emails they are received in office 365 online mailbox and not forwarded on)
    3 on premises server to forward mail to EOP service
    ( which i have done by creating inbound connector in exchange online and adding it as smart host to on premises outbound connector and appears to be working fine.)
    am i missing something?
    any help would be gratefully appreciated
    Many Thanks
    Stephen
    1 first server (AD,AD CS,DC,Dhcp,dns servers and Hyper V)
    setup physical server with windows server 2012 r2 standard Essentials Experience Role installed and hyper v role
    2nd server server (exchange 2013)
    VM with windows server 2012 r2 with exchange server 2013 installed and all updates done including exchange cu1 update.

    Matthew thank you your reply but No it is set for Authoritative. would this be the problem.
    many thanks
    Stephen

  • Unable to SEND mail using Activesync in Exchange 2010 server on iPhone or Windows Mobile 6.1

    Hi All,
    We've been setting up a new SBS 2011 server for a client this week. Everything is working, except the staff have 4 x iPhones to connect with Exchange ActiveSync.
    There are 2 x iPhone 4's and 2 x iPhone 3Gs's. We can setup the Exchange accounts on each of the phones and they are all able to sync mail and calender etc with the server.
    The problem we have is when any of them try to send mail from the phone, it gives an error : "Cannot Send Mail - An error occurred while delivering this message" and it sits in the outbox on the phone.
    The newsgroups and forums are littered with people having issues with IOS4 and Exchange 2010 but most of these are from June-August 2010 when IOS4 version was around 4.00 or 4.01
    A lot of these people had iPhone 3 handsets running with IOS 3.1.3 which worked with Exchange 2010 but when they upgraded to IOS 4, they had this problem sending mail.
    It seems that for most of them, the fix came in the form of IOS version 4.1 which fixed the send issue for them.
    We have a variety of Hansets and IOS versions (including an iPhone 3Gs running IOS 3.1.3) but are unable to send mail from any of them:
    iPhone 3Gs    IOS 3.1.3
    iPhone 3Gs    IOS 4.3.3
    iPhone 4       IOS 4.3.3
    iPhone 4       IOS 4.3.5
    I was surprised that the iPhone 3Gs running 3.1.3 was unable to send either as nearly all the forums etc I read with this issue said the iPhone 3's worked with that IOS version.
    Today we used a test iPhone 4 handset from our office to connect to an almost identical Small Business Server 2011 we setup two weeks ago for another client.
    The test iPhone 4 was able to connect, Sync and Send email on that server but when set it to connect to this SBS 2011 server, it gets the "Cannot Send Mail" message the same as the others. So clearly the handset is working (on the other server at least),
    it must be something misconfigured in this Exchange server right?
    We ran the Exchange Remote Connectivity Analyser on the Exchange server and got green ticks across the board.
    Outlook Web App and Outlook Anywhere both work normally. Everything we can test on the Exchange server works except sending from any iPhone.
    Having said all that, I just setup a Windows Mobile 6.1 handset to sync with the Exchange 2010 server as a test, and it appears to have the same issue.
    It will connect & Sync Mail, Contacts and Calendar but if trying to send an email from the phone, it will just sit in the outbox.
    Does anyone have some insight into what the problem may be?

    Further to this .. I found the solution on a MS Exchange 2010 support forum.
    It was not a certificate or firewall issue, looks as thought the “Accepted Domains” in Exchange Mgmt Console –
    Org Config – Hub Transport cannot have any spaces in the name field.
    I had some spaces and the emails were not downloading fully and able to send. Once I removed the spaces from the Name field and
    restarting the Exchange and IIS services emails were now being sent and received ok.
     Check
    out :
    http://social.technet.microsoft.com/Forums/en-US/exchangesvrmobility/thread/321eae51-9cbd-4a5e-85c1-68d8f7b523c3
     This
    is good one to add to your knowledge bank in case you come across it in the future.
    Rgds Gerry

Maybe you are looking for