Class javax.mail.SendFailedException

Hi,
Let me know regarding java mail. I am facing the error as follows,
===============Exception=====================
javax.servlet.ServletException: Sending failed;
nested exception is:
     class javax.mail.SendFailedException: Invalid Addresses;
nested exception is:
     class javax.mail.SendFailedException: 550 not local host gmail.com, not a gateway
     org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextImpl.java:825)
     org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:758)
     org.apache.jsp.sendmail3_jsp._jspService(sendmail3_jsp.java:75)
     org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:94)
     javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
     org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:324)
     org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:292)
     org.apache.jasper.servlet.JspServlet.service(JspServlet.java:236)
     javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
================sourcecode============================
<%@ page import="java.util.*, javax.mail.*, javax.mail.internet.*" %>
<%
Properties props = new Properties();
props.put("mail.smtp.host", "66.34.40.98");
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);
%>
<html>
<p align="center">A Message has been sent.<br>Check your inbox.</p>
<p align="center">Click here to send another!</p>
</html>

Is there any rule defined on the mailserver that BPEL is accessing via SMTP? Is it directly checking the address for validation or something?
Can you do a SMTP transaction on the BPEL server for this mail account only?
1) Create a notification process that sends a mail only for this user.
2) open a telnet session from the BPEL server commandline to do a SMTP conference.
http://nl.wikipedia.org/wiki/Simple_Mail_Transfer_Protocol

Similar Messages

  • Invalid Addresses; nested exception is: class javax.mail.SendFailedException: 550 5.7.1 Unable to relay for

    Hi!
    I am with a problem during a sending e-mail for 3500
    addressees.
    In the way it process me of the one error and in log CF
    Administrator shows the following error to it:
    Invalid Addresses; nested exception is: class
    javax.mail.SendFailedException: 550 5.7.1 Unable to relay for
    What it could be?
    Server Configuration:
    Windows 2003 Standard with ColdFusion MX 7.02 (last update)
    Best Regards

    You need to either authenticate your user or turn on relaying in your SMTP server. See the JavaMail tutorial for how to authenticate

  • Javax.mail.SendFailedException: 550 5.7.1 Unable to relay

    Hi All,
    I am getting the below Exception message when I am executing my JavaMail
    program.
    nested exception is:
         javax.mail.SendFailedException: Invalid Addresses;
    nested exception is:
         javax.mail.SendFailedException: 550 5.7.1 Unable to relay for [email protected]
    Please can anyone help me out.
    Regards,
    Ravi.

    what's wrong to this source code, if try to send mail to local account actually it success, but if i try to send mail eg:[email protected](outside my network) i found error this error to. i had to try not use encode userID/password into base64, but the result doesn't change.
    if anyone have solution for this problem, please contact me @ [email protected]
    Regards,
    agam
    error returned by java:
    javax.mail.SendFailedException: Invalid Addresses;
    nested exception is:
    class javax.mail.SendFailedException: 550 Relaying is prohibited
    void com.sun.mail.smtp.SMTPTransport.sendMessage(javax.mail.Message, javax.mail.Address[])
    import java.util.*;
    import java.io.*;
    import javax.mail.*;
    import javax.mail.internet.*;
    import javax.activation.*;
    import com.sun.mail.smtp.SMTPTransport;
    import com.agam198.util.*;
    public class PCMMail{
    String sMailServer = "";
    String sUserID = "";
    String sPassword = "";
    int iPort = 25;
    String sTo = "";
    String sFrom = "";
    String sCC = "";
    Message msg = null;
    SMTPTransport transport = null;
    Transport trns = null;
    public PCMMail(StringPool sPool){
    this.sMailServer = sPool.getString("SMTPServer.SERVER");
    this.sTo = sPool.getString("SMTPAlert.TO");
    this.sFrom = sPool.getString("SMTPAlert.FROM");
    this.sCC = sPool.getString("SMTPAlert.CC");
    this.sUserID = sPool.getString("SMTPServer.LOGIN");
    this.sPassword = sPool.getString("SMTPServer.PASSWORD");
    this.iPort = Integer.parseInt(sPool.getString("SMTPServer.PORT"));
    initConnection();
    public void initConnection(){
    try{
    System.out.println("MailServer: "+sMailServer);
    System.out.println("To: "+sTo);
    System.out.println("From: "+sFrom);
    System.out.println("CC: "+sCC);
    Properties props = new Properties();
    props.put("mail.smtp.host", "152.118.89.0");
    Session session = Session.getDefaultInstance(props,null);
    trns = session.getTransport("smtp");
    if(trns == null){
    System.out.println("trans is not null");
    else
    System.out.println("trans null");
    trns.connect(sMailServer,Base64.base64Encode ( sUserID ),Base64.base64Encode ( sPassword ));
    if(trns.isConnected()){
    System.out.println("connected to SMTP SERVER");
    else{
    System.out.println("not connect");
    InternetAddress address = new InternetAddress();
    //create a message
    msg = new MimeMessage(session);
    catch(Exception e){
    public void sendMessage(String message){
    sendMessage(getFirstLine(message),message);
    public void sendMessage(String subject,String message){
    try{
    //prepare message
    msg.setFrom(new InternetAddress(sFrom));
    msg.setRecipients(Message.RecipientType.TO, InternetAddress.parse(sTo));
    msg.setSubject(subject);
    msg.setSentDate(new Date());
    msg.setText(message);
    trns.send(msg);
    System.out.println("message sent");
    catch(Exception e){
    e.printStackTrace();
    public String getFirstLine(String message){
    BufferedReader buf = new BufferedReader(new StringReader(message));
    try{
    return buf.readLine();
    catch(Exception e){
    return " ";
    public static void main(String[] args){
    StringPool sp = new StringPool();
    sp.set("SMTPServer.SERVER","152.118.89.0");
    sp.set("SMTPServer.PORT","25");
    sp.set("SMTPServer.LOGIN","kiara");
    sp.set("SMTPServer.PASSWORD","kiara");
    sp.set("SMTPAlert.TO","[email protected]");
    sp.set("SMTPAlert.FROM","[email protected]");
    sp.set("SMTPAlert.CC","");
    PCMMail pcm = new PCMMail(sp);
    pcm.sendMessage("subject","message body");
    }

  • Inquiry on javax.mail.SendFailedException: Invalid Addresses error

    Hi,
    Anyone does have any idea why the following is being encountered during the email authentication process? We are using PeopleSoft application and we have notification functionality which will send a notification email to the users but email not being sent due to an invalid email address but actually the email is active and valid. Below are the logs from SMTP
    Log Start:
    DEBUG SMTP: Sending failed because of invalid destination addresses
    Wed Jul 31 09:38:14 GMT+08:00 2013 RSET
    Wed Jul 31 09:38:14 GMT+08:00 2013 250 2.0.0 Resetting
    Wed Jul 31 09:38:20 GMT+08:00 2013 javax.mail.SendFailedException: Invalid Addresses;
    nested exception is:
    class com.sun.mail.smtp.SMTPAddressFailedException: 550 5.1.1 User unknown
    Wed Jul 31 09:38:20 GMT+08:00 2013 at com.sun.mail.smtp.SMTPTransport.rcptTo(SMTPTransport.java:1141)
    Wed Jul 31 09:38:20 GMT+08:00 2013 at com.sun.mail.smtp.SMTPTransport.sendMessage(SMTPTransport.java:536)
    Wed Jul 31 09:38:20 GMT+08:00 2013 at com.peoplesoft.pt.mcf.mail.MCFOutboundEmail.send(MCFOutboundEmail.java:686)
    Wed Jul 31 09:38:20 GMT+08:00 2013 at com.peoplesoft.pt.mcf.mail.MCFOutboundEmail.send(MCFOutboundEmail.java:854)
    Log End:
    Kindly let us know your thoughts on this.
    Thanks.

    This isn't an authentication problem.  You're sending to an address that your server doesn't know about, so it's rejecting your message.  The error from the server is:
    550 5.1.1 User unknown

  • [help] javax.mail.SendFailedException

    What it means?
    javax.mail.SendFailedException: Invalid Addresses; nested exception is: class com.sun.mail.smtp.SMTPAddressFailedException: 553 sorry, that domain isn't in my list of allowed rcpthosts (#5.7.1)
    I use javax.mail API to send email from java servlet using a .info smtp server.
    It is the domain .info that create this error?
    Can i resolve?
    I tryed with a .it smtp server but it doesn't change...only with the server smtp of my ISP the mail was send correctly!
    Sorry for my english...Help Me!

    The SMTP server you use does not allow relaying mesages from/to the specified domain. Example: you cannot use yahoo's SMTP server to relay an email to [email protected] Change your rcpthosts on the SMTP server.

  • Javax.mail.SendFailedException: Recipient unknown

    Hi,
    I know similar topics have been posted before but even after going through them all I have still not found a solution.
    I am trying to send alert emails through my JavaMail application and get the Exception below. I am able to send emails to internal address', but not external address' such as my hotmail account. I have even asked the Administrator to put my IP address in the list of allowed IP's. Does anyone have any ideas? If anyone would like to take a look at the source code i have pasted it underneath the stacktrace.
    Thanks in advance.
    javax.mail.SendFailedException: Sending failed;
    nested exception is:
    javax.mail.SendFailedException: Invalid Addresses;
    nested exception is:
    javax.mail.SendFailedException: 550 <[email protected]>, Recipient unknown
    javax.mail.SendFailedException: Sending failed;
    nested exception is:
    javax.mail.SendFailedException: Invalid Addresses;
    nested exception is:
    javax.mail.SendFailedException: 550 <[email protected]>, Recipient unknown
    at javax.mail.Transport.send0(Transport.java:218)
    at javax.mail.Transport.send(Transport.java:80)
    at Test1.main(Test1.java:28)
    SOURCE:
    import javax.mail.internet.*;
    import javax.activation.*;
    final public class Test1 {
    private static Session session;
    public static void main(String[] args)
         try
              Properties props = new Properties();
              props.put ("mail.smtp.host", "207.132.45.5");
              props.put ("mail.smtp.port", "25");
              session = Session.getInstance(props, null);
              MimeMessage message = new MimeMessage(session);
              message.setFrom (new InternetAddress ("[email protected]"));
              message.setRecipient (Message.RecipientType.TO, new InternetAddress ("[email protected]"));
              message.setSubject ("test message");
              Multipart multipart = new MimeMultipart();
              BodyPart messageBodyPart = new MimeBodyPart();
              multipart.addBodyPart (messageBodyPart);
              messageBodyPart.setText ("message body");
              message.setContent (multipart);
              javax.mail.Transport.send (message);
         } catch (Exception e) {
              System.out.println (e.toString());
              e.printStackTrace();

    Personal, I am sending a class example that uses authentication in the email sending:
    * Class JAVA
    import javax.mail.*;
    import javax.mail.internet.*;
    import java.util.*;
    import java.lang.*;
    import java.lang.Exception;
    public class email
    public void sendSimpleMail (String mailServer, String subject,String to,String from, String mensagem)
    throws AddressException , MessagingException
    Properties mailProps = System.getProperties();
    mailProps.put("mail.smtp.host", mailServer);
    mailProps.put("port","25");
    mailProps.put("mail.smtp.auth", "true");
    Session mailSession = Session.getDefaultInstance(mailProps, new MyPasswordAuthenticator("username", "password"));
    InternetAddress destinatario = new InternetAddress (to);
    InternetAddress remetente = new InternetAddress (from);
    Message message = new MimeMessage (mailSession);
    message.setFrom(remetente);
    message.setRecipient( Message.RecipientType.TO, destinatario );
    message.setSubject (subject);
    message.setContent (mensagem.toString(), "text/plain");
    try
    Transport transport = mailSession.getTransport("smtp");
    transport.connect(mailServer," ", " ");
    transport.send(message);
    catch (javax.mail.SendFailedException sfe)
    System.out.println("FALHA: " + sfe);
    catch (MessagingException e)
    System.out.println("erro: " + e);
    /** This is the authenticator for SMTP session */
    public static class MyPasswordAuthenticator extends Authenticator
    private String username = null;
    private String password = null;
    public MyPasswordAuthenticator(String username, String password)
    super();
    this.username = username;
    this.password = password;
    public PasswordAuthentication getPasswordAuthentication()
    return new PasswordAuthentication(username, password);
    * File JSP
    <html>
    <body>
    <%@ page import="email, javax.mail.*, javax.mail.internet.*, java.util.*" %>
    <jsp:useBean id="email" scope="session" class="email"/>
    <%
    try
    String mailServer = "myServer";
    String assunto = request.getParameter("assunto");
    String para = request.getParameter("para");
    String de = request.getParameter("de");
    String mensagem =request.getParameter("mensagem");
    email.sendSimpleMail(mailServer, assunto, para, de, mensagem);
    %>
    <p>Email enviado com Sucesso !!!</p>
    <%
    catch (AddressException e)
    %> <p>Endereco de Email invalido</p><%
    catch (MessagingException e)
    %> <p>Impossivel enviar o email.</p><%
    %>
    </body>
    </html>

  • Javax.mail.SendFailedException

    HI all,
    I have an application which reads .csv file, picks up email ids and sends e-mail to mentioned 'to' address.
    There are 199 diffreent email ids. I could send upto 90 emails.
    But, after that, i got following error !
    error message:
    javax.mail.SendFailedException: Sending failed; nested exception is: javax.mail.MessagingException: Could not connect to SMTP host: mail.**********.com, port: 25
    I don't know the reason for it. Can any one please guide me in this regard?
    Thanks in advance !
    Regards
    Ashvini

    Try to give all the address in TO field with comma seperation and check it out.
    Regards
    Balu

  • Javax.mail.SendFailedException: 550 5.7.1 ... Relaying denie

    My machine is on the DNS and does not require authentication to send e-mail. It also can send and recieve e-mail from the outside world with no problems; however this is the error I see in the logs:
    2003-12-11 10:03:49,151 INFO org.dspace.app.webui.servlet.RegisterServlet @ anonymous:session_id=8E5A9C16A74EAA9F334FF566CB6714BF:error_emai$
    javax.mail.SendFailedException: Sending failed;
    nested exception is:
    javax.mail.SendFailedException: Invalid Addresses;
    nested exception is:
    javax.mail.SendFailedException: 550 5.7.1 <[email protected]>... Relaying denied
    at javax.mail.Transport.send0(Transport.java:219)
    at javax.mail.Transport.send(Transport.java:81)
    at org.dspace.core.Email.send(Email.java:259)
    at org.dspace.eperson.AccountManager.sendEmail(AccountManager.java:291)
    at org.dspace.eperson.AccountManager.sendInfo(AccountManager.java:251)
    at org.dspace.eperson.AccountManager.sendRegistrationInfo(AccountManager.java:96)
    at org.dspace.app.webui.servlet.RegisterServlet.processEnterEmail(RegisterServlet.java:272)
    at org.dspace.app.webui.servlet.RegisterServlet.doDSPost(RegisterServlet.java:206)
    at org.dspace.app.webui.servlet.DSpaceServlet.processRequest(DSpaceServlet.java:153)
    at org.dspace.app.webui.servlet.DSpaceServlet.doPost(DSpaceServlet.java:110)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:247)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:193)
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:256)
    at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
    at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
    at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
    at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
    at org.apache.catalina.valves.CertificatesValve.invoke(CertificatesValve.java:246)
    at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
    at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
    at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
    at org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2416)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:180)
    at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
    at org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.java:171)
    Can someone tell me what I am doing wrong here?
    Thanks.

    The important line in the stack trace is
    javax.mail.SendFailedException: 550 5.7.1 <[email protected]>... Relaying denied
    The 550 error is being returned by the SMTP server to the your client as per the RFC.. It tells us that the client has built a message and has pushed it to the server. The server is looking at the message and finds something it doesn't like. It then returns the 500 series error to the client.
    The relative locations of the server and client may be an issue since you can configure your server to treat clients run locally different, usually you have the localhost unrestricted and put the filters on for everyone else (there are some admins that lock down local clients on the theory that no one should be running a client on the server so if someone tries they must have hacked the box).
    If you try running a different client on the machine with the identical settings for all the header fields you will still get the 550 error. At this point I would have a talk with the admin and ask what the rules for the server are.

  • Authorization error for referenced class javax/mail/Session.

    All,
    I am trying to compile a java source which is using session object in javax/mail/session.
    I am getting the error java/lang/System: Authorization error for referenced class javax/mail/Session.
    I used "import javax.mail.*;" in my java source..
    I loaded both mail.jar and activation.jar using the below command in different schema other than the schema which above java source exists.
    loadjava -thin -verbose -user <user>/<pwd>@<dburl> -resolve -synonym activation.jar
    loadjava -thin -verbose -user <user>/<pwd>@<dburl> -resolve -synonym mail.jar
    After loading, All java classes in mail.jar and activation.jar were in compiled state in that schema
    Its working well in different database having the same configuration.
    My oracle version is Oracle9i Enterprise Edition Release 9.2.0.6.0 - 64bit Production

    I have to accomplish tried in CONSOLE TestMail.class:
    C>java TestMail
    Exception in thread "main" java.lang.NoClassDefFoundError: javax/mail/Partmy make.bat:
    javac -g -classpath
    ...\Java\jre1.5.0_06\lib\activation.jar;...\jre1.5.0_06\lib\imap.jar;...\jre1.5.0_06\lib\mail.jar;...\jre1.5.0_06\lib\mailapi.jar;...\jre1.5.0_0\lib\plugin.jar;...\jre1.5.0_06\lib\pop3.jar;...\jre1.5.0_06\lib\smtp.jar;...\jre1.5.0_06\lib\javamail-1_3_2-src-jrl.zip;...\jre1.5.0_06\lib\j2ee.jar  TestMail.javaWhat isn't correct?
    Tanks,
    Mohammad

  • Please help! javax.mail.SendFailedException is killing me

    im trying to send myself an email through javax.mail and this is the error i get: it is thrown from Transport.send(msg);i dont have access to its source so i cannot trace through it... can anyone please tell me what might cause this error?
    javax.mail.SendFailedException: 550 <[email protected]>: Recipient address rejected: Relay access denied

    Hi,
    I'm trying to send mail thro a servlet.
    When I use host as 'mail.vsnl.com'
    It gives the following exeception
    Relay access denied
    can U help me!
    thanks in adv.
    Isaaac

  • Javax.mail.SendFailedException: Invalid Addresses

    Hi all,
    I write a web application with a module can send mail to specific mail address using JAVAMAIL . I test my SendMail.java  which has sendEmail() function with command line ../java SendMail and it run OK. But when I call sendEmail() from my web page it throw out ERROR: javax.mail.SendFailedException: Invalid Addresses.
    I don't know why? Do you have any idea about it ?
    Thanks!

    Hi all,
    This is more Error information:
    javax.mail.SendFailedException: Invalid Addresses;
      nested exception is:
        com.sun.mail.smtp.SMTPAddressFailedException: 550 5.7.1 Unable to relay
        at com.sun.mail.smtp.SMTPTransport.rcptTo(SMTPTransport.java:1294)
        at com.sun.mail.smtp.SMTPTransport.sendMessage(SMTPTransport.java:635)
        at view.MailImplement.sendEmail(MailImplement.java:152)
        at view.MailImplement.main(MailImplement.java:40)
    Caused by: com.sun.mail.smtp.SMTPAddressFailedException: 550 5.7.1 Unable to relay
    Thanks a lot!

  • Error: javax.mail.SendFailedException

    Hi all,
    I have a requirement to send a mail on click of a button. I have written a simple java code using java mail API. But while running the application i am getting
    javax.mail.SendFailedException: Sending failed;  nested exception is: javax.mail.SendFailedException: Invalid Addresses;  nested exception is: javax.mail.SendFailedException: 550 5.7.1 Unable to relay for [email protected]
    If i run the java code as a standalone java application everything is fine. Only in webdynpro application i am getting the above mentioned error.
    My question is do we have to configure any settings in the WAS. If so, can somebody give me a detailed answer how to do the configuration.
    Thanks and Regards,
    Rathna

    I stopped the Antivirus service and checked the application but it doesn't help.
    Here is the code. But the code is working fine.
    // Get system properties
    Properties props = new Properties();
    // Setup mail server
    props.put("mail.pop3.host","myserver");
    props.put("mail.pop3.auth","true");
    Authentication auth = new Authentication("[email protected]","abcd");
                   Session session = Session.getInstance(props,auth);
                   Store store = session.getStore("pop3");
                   store.connect("myserver","[email protected]","abcd");
                   System.out.println("Connected");
                   MimeMessage message =  new MimeMessage(session);
                   message.setFrom(new InternetAddress("[email protected]"));
                   message.addRecipient(javax.mail.Message.RecipientType.TO, new InternetAddress("[email protected]"));
                   message.setSubject("Hello JavaMail Attachment");
                   // create the message part
                   MimeBodyPart messageBodyPart =  new MimeBodyPart();
                   //fill message
                   messageBodyPart.setText("Hi");
                   Multipart multipart = new MimeMultipart();
                   multipart.addBodyPart(messageBodyPart);
                   // Part two is attachment
                   messageBodyPart = new MimeBodyPart();
                   String fileAttachment="D:\Message.txt";
                   DataSource source =  new FileDataSource(fileAttachment);
                   messageBodyPart.setDataHandler(new DataHandler(source));
                   messageBodyPart.setFileName(fileAttachment);
                   multipart.addBodyPart(messageBodyPart);
                   // Put parts in message
                   message.setContent(multipart);
                                  // Send the message
                   javax.mail.Transport.send(message);
                   System.out.println("Mail sent successfully");
                   store.close();

  • Javax.mail.SendFailedException: 550 5.7.1

    While trying to insert technician details into the DB, I get the following error. In the details I am entering an email id to which an email should be sent describing the details. The error is below :
    Error:  Error while Inserting Technician Details.Sending failed; nested exception is: javax.mail.SendFailedException: Invalid Addresses; nested exception is: javax.mail.SendFailedException: 550 5.7.1 Unable to relay for [email protected]
    Could anyone please suggest a solution ?.
    Your answers would be rewarded!!
    Thanks,
    Padmarajan

    Hi Padmarajan,
    Can you try this first from your Portal server ...
    telnet smtpserverip 25
    if you can connect then try sending a dummy mail to the same id as mentioned below.
    This will help to verify if the problem exists at Portal level or SMTP server
    regards,
    piyush
    ps: please mark all useful answers.
    regards,
    piyush

  • Javax.mail.SendFailedException: 553 sorry, that domain isn't in my list of

    i have put all the lines in the code required to set the server name and the username and the password but it still gives me the error. i have the following code to send the mail.
    package com.wesra.mail;
    import java.io.PrintStream;
    import java.util.Hashtable;
    import java.util.Properties;
    import javax.mail.*;
    import javax.mail.internet.*;
    public class SendEmail extends Authenticator
    InternetAddress from = null;
    InternetAddress to = null;
    InternetAddress cc = null;
    InternetAddress bcc = null;
    String subject = null;
    Object body = null;
    Message msg = null;
    static Session session = null;
    String msgText = null;
    Properties prop = null;
    MimeMultipart mimemultipart = null;
    public SendEmail()
    from = null;
    to = null;
    cc = null;
    bcc = null;
    subject = null;
    body = null;
    msg = null;
    msgText = null;
    prop = null;
    mimemultipart = null;
    msgText = new String("");
    prop = System.getProperties();
    mimemultipart = new MimeMultipart();
    public void setDetails(String s, String s1, String s2, String s3, String s4, String s5)
    throws Exception
    from = new InternetAddress(s1);
    to = new InternetAddress(s);
    cc = new InternetAddress(s2);
    bcc = new InternetAddress(s3);
    subject = new String(s4);
    body = new MimeBodyPart();
    prop.put("mail.smtp.host", s5);
    public boolean sendEmail(String s, int i)
    throws Exception
    session = Session.getDefaultInstance(prop, null);
    MimeMessage mimemessage = new MimeMessage(session);
    MimeMultipart mimemultipart1 = new MimeMultipart();
    if(i > 1)
    mimemessage.setRecipient(javax.mail.Message.RecipientType.CC, cc);
    if(i > 2)
    mimemessage.setRecipient(javax.mail.Message.RecipientType.BCC, bcc);
    mimemessage.setRecipient(javax.mail.Message.RecipientType.TO, to);
    mimemessage.setSubject(subject);
    msgText = s;
    MimeBodyPart mimebodypart = new MimeBodyPart();
    mimebodypart.setContent(msgText, "text/html");
    mimemultipart1.addBodyPart(mimebodypart);
    mimemessage.setContent(mimemultipart1);
    mimemessage.setFrom(from);
    System.out.println("Message is being sent...");
    Transport.send(mimemessage);
    System.out.println("Message Sent Successfully");
    return true;
    i write the following lines to call the code.
    se1.setDetails(to,from,to1,to2,subject,server);// this is called with the appropriate parameters with the server being either wesra.com,wesra.in or nmims.edu but none of that works.please check it and let me know what is wrong.
    boolean sentstatus=se1.sendEmail(msgText1,number);

    It sounds like a configuration problem with your SMTP server. Perhaps the machine from which you're connecting to the mail server isn't allowed to send mail to other domains. That'll be something you need to fix on the mail server.
    Anyway, I'd suggest plugging that error message into Google... you'll get hundreds of matches.

  • When will javax.mail.SendFailedException throw?

    hi, i am a beginner of java and javamail
    I need to know when SendFailedException will throw (under what conditions).
    Is there any documentation I can read?
    thank you very much

    In general, you'll get SendFailedException when your server reports an error.
    You can read the SMTP spec to understand the general categories of errors
    it might report, but the specific cases will depend on your server.

Maybe you are looking for

  • Windows Service no longer able to print PDF files using Adobe Reader 11.0.07.79

    We have a Windows Service that watches a folder for PDF files to be deposited.  Once awakened, it executes the Adobe Reader in command line mode to print the PDF files to secure check printers. The Windows Service was working fine with 11.0.06.70 but

  • How to pass '&' as a parameter in IDOC Status avoiding it to be replaced

    Hi,    This is the issue I have. Say an IDOC got status 51 when trying to post it. One of the messages to be appended in table EDIDS is: Message Class   Message Number    Text ZZ                      001                       This is parmeter1  & and

  • Passing values to servlet

    HI All I am developing a project using html and servlets. from my html page(regis.html) i am trying to pass the values which are entered by the user to the servlet (Admin_Regis.java) which is in the another package called Admin. The way i am doing is

  • Interactive Text

    Can anyone point me in the right direction. What I am wanting to do is display text in a UI that is interactive. When the user clicks on a word, I want to add it to a swap table and replace it with an alternate value (such as a French word for an Eng

  • Form on Table - Where is Where Clause?

    I am a newbie so sorry if this is a easy question. I created a form on a table. Each user will have one record on the table for them. When they access this page, I want the form to either allow them to create their record for the first time or update