Java mail api error- Please Help

Hi, i have set up an smtp server on my local machine. i have given the smtp host address as 127.0.0.1
I am getting the following error though. please help me out with the problem
C:\trainee>java Emailer
javax.mail.SendFailedException: Invalid Addresses;
nested exception is:
com.sun.mail.smtp.SMTPAddressFailedException: 550 5.7.1 Unable to relay for [email protected]
nested exception is:
com.sun.mail.smtp.SMTPAddressFailedException: 550 5.7.1 Unable to relay for [email protected]
nested exception is:
com.sun.mail.smtp.SMTPAddressFailedException: 550 5.7.1 Unable to relay for [email protected]
nested exception is:
com.sun.mail.smtp.SMTPAddressFailedException: 550 5.7.1 Unable to relay for [email protected]
nested exception is:
com.sun.mail.smtp.SMTPAddressFailedException: 550 5.7.1 Unable to relay for [email protected]
nested exception is:
com.sun.mail.smtp.SMTPAddressFailedException: 550 5.7.1 Unable to relay for [email protected]
nested exception is:
com.sun.mail.smtp.SMTPAddressFailedException: 550 5.7.1 Unable to relay for [email protected]
at com.sun.mail.smtp.SMTPTransport.rcptTo(SMTPTransport.java:1196)
at com.sun.mail.smtp.SMTPTransport.sendMessage(SMTPTransport.java:584)
at javax.mail.Transport.send0(Transport.java:169)
at javax.mail.Transport.send(Transport.java:98)
at Emailer.sendEmail(Emailer.java:151)
at Emailer.main(Emailer.java:194)
Caused by: com.sun.mail.smtp.SMTPAddressFailedException: 550 5.7.1 Unable to relay for [email protected]
nested exception is:
com.sun.mail.smtp.SMTPAddressFailedException: 550 5.7.1 Unable to relay for [email protected]
nested exception is:
com.sun.mail.smtp.SMTPAddressFailedException: 550 5.7.1 Unable to relay for [email protected]
nested exception is:
com.sun.mail.smtp.SMTPAddressFailedException: 550 5.7.1 Unable to relay for [email protected]
at com.sun.mail.smtp.SMTPTransport.rcptTo(SMTPTransport.java:1047)
... 5 more
Caused by: com.sun.mail.smtp.SMTPAddressFailedException: 550 5.7.1 Unable to relay for [email protected]
nested exception is:
com.sun.mail.smtp.SMTPAddressFailedException: 550 5.7.1 Unable to relay for [email protected]
... 6 more
Caused by: com.sun.mail.smtp.SMTPAddressFailedException: 550 5.7.1 Unable to relay for [email protected]
... 6 more

It's a configuration error in your smtp server.
See the JavaMail FAQ for more information.

Similar Messages

  • Mail api exception please help

    Well i have tried many times to send email .But the exception arise can any body please tell where i am wrong.
    Here is the code
    import java.util.Properties;
    import javax.mail.*;
    import javax.mail.internet.*;
    public class MailExample {
    public static void main (String args[]) throws Exception {
    // Get system properties
    Properties props = System.getProperties();
    // Setup mail server
    props.put("mail.smtp.host","mail.yahoo.com");
    // Get session
    Session session = Session.getDefaultInstance(props, null);
    // Define message
    MimeMessage message = new MimeMessage(session);
    // Set the from address
    message.setFrom(new InternetAddress
    "[email protected]"));
    // Set the to address
    message.addRecipient(Message.RecipientType.TO,
    new InternetAddress("[email protected]"));
    // Set the subject
    message.setSubject("Hello JavaMail");
    // Set the content
    message.setText("Welcome to JavaMail i got it");
    // Send message
    Transport.send(message);
    <b>Exception in thread "main" javax.mail.SendFailedException: Sending failed;
    nested exception is:
    javax.mail.MessagingException: Could not connect to SMTP host: mail.yaho
    o.com, port: 25;
    nested exception is:
    java.net.NoRouteToHostException: Operation timed out: no further informa
    tion
    at javax.mail.Transport.send0(Transport.java:219)
    at javax.mail.Transport.send(Transport.java:81)
    at MailExample.main(MailExample.java:35)<b>
    Thanks
    Jawwad Ahmed

    Yahoo will probably give u errors becoz i think they have recently changed to "NO RELAY" mode for their Mail Server....why don't u setup ur own mail server.....IMAIL server or 1st Class server are typical Servers,
    Cheers,
    Manja

  • Domino Address book from Java Mail API

    Hi
    How do we access the address book of a mail server (typically a Domino mail server in my case) using Java Mail API.
    Any help will be greatly appreciated.
    Thanks
    RajT

    Havent done this myself but I dont think the JavaMail api will do this as its focussed on providing mail functionality rather than directory access.
    I believe you can access the Domino address book using LDAP. Not sure of the details, or if you need to config the domino server a particular way. The Java api that will help you do this is JNDI, though if your application is domino specific you may actually find it easier to avoid the LDAP approach and see what functioanlity the Notes java api provides in this area.
    Check out this redbook:
    http://publib-b.boulder.ibm.com/Redbooks.nsf/RedbookAbstracts/sg245986.html?Open

  • About Java Mail Api ...Please help..?

    Hi,
    I am sending email thruogh java mail api. Email has sent but in console, It is in debug mode as this is the messages:
    DEBUG: JavaMail version 1.4.1*
    DEBUG: not loading file: C:\Program Files\Java\jdk1.6.0_10\jre\lib\javamail.providers*
    DEBUG: java.io.FileNotFoundException: C:\Program Files\Java\jdk1.6.0_10\jre\lib\javamail.providers (The system cannot find the file specified)*
    DEBUG: !anyLoaded*
    DEBUG: not loading resource: /META-INF/javamail.providers*
    DEBUG: successfully loaded resource: /META-INF/javamail.default.providers*
    DEBUG: Tables of loaded providers*
    +DEBUG: Providers Listed By Class Name: {com.sun.mail.smtp.SMTPSSLTransport=javax.mail.Provider[TRANSPORT,smtps,com.sun.mail.smtp.SMTPSSLTransport,Sun Microsystems, Inc], com.sun.mail.smtp.SMTPTransport=javax.mail.Provider[TRANSPORT,smtp,com.sun.mail.smtp.SMTPTransport,Sun Microsystems, Inc], com.sun.mail.imap.IMAPSSLStore=javax.mail.Provider[STORE,imaps,com.sun.mail.imap.IMAPSSLStore,Sun Microsystems, Inc], com.sun.mail.pop3.POP3SSLStore=javax.mail.Provider[STORE,pop3s,com.sun.mail.pop3.POP3SSLStore,Sun Microsystems, Inc], com.sun.mail.imap.IMAPStore=javax.mail.Provider[STORE,imap,com.sun.mail.imap.IMAPStore,Sun Microsystems, Inc], com.sun.mail.pop3.POP3Store=javax.mail.Provider[STORE,pop3,com.sun.mail.pop3.POP3Store,Sun Microsystems, Inc]}+*
    +DEBUG: Providers Listed By Protocol: {imaps=javax.mail.Provider[STORE,imaps,com.sun.mail.imap.IMAPSSLStore,Sun Microsystems, Inc], imap=javax.mail.Provider[STORE,imap,com.sun.mail.imap.IMAPStore,Sun Microsystems, Inc], smtps=javax.mail.Provider[TRANSPORT,smtps,com.sun.mail.smtp.SMTPSSLTransport,Sun Microsystems, Inc], pop3=javax.mail.Provider[STORE,pop3,com.sun.mail.pop3.POP3Store,Sun Microsystems, Inc], pop3s=javax.mail.Provider[STORE,pop3s,com.sun.mail.pop3.POP3SSLStore,Sun Microsystems, Inc], smtp=javax.mail.Provider[TRANSPORT,smtp,com.sun.mail.smtp.SMTPTransport,Sun Microsystems, Inc]}+*
    DEBUG: successfully loaded resource: /META-INF/javamail.default.address.map*
    DEBUG: !anyLoaded*
    DEBUG: not loading resource: /META-INF/javamail.address.map*
    DEBUG: not loading file: C:\Program Files\Java\jdk1.6.0_10\jre\lib\javamail.address.map*
    DEBUG: java.io.FileNotFoundException: C:\Program Files\Java\jdk1.6.0_10\jre\lib\javamail.address.map (The system cannot find the file specified)*
    it is printing more statements. I just want to remove that can i ? I had tried session.setDebug(false). But still showing me debug messages. please tell me it is really urgent.
    thanks in advance.
    Manveer
    Edited by: Manveer-Singh on Feb 2, 2010 5:25 PM

    Remove the logger statement from your program,
    or
    Check your IDE is in debug mode
    or
    paste your code and tell what environment are you using.

  • Error while sending mail when using Java Mail API

    Hi Experts,
    I am trying to execute a webdynpro application which uses the Java Mail API to send emails. The exception that I get on executing the application is :
    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]
    Can anybody please help me sort out the issue.
    Regards
    Abdullah

    Hi,
    Usually one get this error if the SMTP server is configured not to relay mails (a security measure) or the SMTP server need the mail to be sent from a trusted IP or with proper authentication. Some SMTP servers are configured to block junk mails.
    Pls check with your  mail server administrator.
    Regards

  • How do i invoke Windows APIs in JAVA??? Please help.

    Is there a way to invoke Windows APIs in Java??? Please help......Thankx

    Short answer, you don't. However, you should look at Java Native Interface (JNI) very closely. It will allow you to wrap the Win32 API calls so that Java can call your wrapper methods. Another side to it, although not necessarily related to your question is a JavaBeans to COM bridge that you may want to look into as well, though it's probably not going to be a solution for what you're wanting to do right now.

  • Save Attachment from exchange server 2010 from oracle using java mail API

    Hello,
    I want to read email from microsoft exchangeserver 2010 and save attachement into a folder.I created an Java program to import attachments from a exchange server mailbox using "POP3S".It works fine when run as a java application.But when i put this inside Oracle11g R2 using load java and while executing from a procedure it gives an error at parsing message into Multipart
    Error at line : Multipart mp = (Multipart)m.getContent();
    Error:
    Content-Type: multipart/mixed;
    boundary="_002_A0C2E09A..................................."
    java.lang.ClassCastException
    at mailPop3.checkmail(mailPop3:71)
    My Java Class is as follows,
    import java.io.*;
    import java.util.Properties;
    import javax.mail.*;
    import javax.mail.internet.*;
    import java.util.Date;
    The function i used to check for attachments is given below.
    public static boolean hasAttachments(Message m) throws java.io.IOException, MessagingException
    Boolean hasAttachments = false;
    try
    // if it is a plain/html text - no attachements
    if (m.isMimeType("text/*"))
    return hasAttachments;
    else if (m.isMimeType("multipart/alternative"))
    return hasAttachments;
    else if (m.isMimeType("multipart/*"))
    Multipart mp = (Multipart)m.getContent();
    if (mp.getCount() > 1)
    hasAttachments = true;
    return hasAttachments;
    catch (Exception e) {
    e.printStackTrace();
    } finally {
    return hasAttachments;
    My Java Details as follows
    java Version :1.5.0_10
    java.vm.specification.version:1.0
    java.vm.version :1.5.0_01
    java.specification.version:1.5
    java.class.version:48.0
    Java mail API:javamail-1.4.4
    Used Jars:mail.jar
    Could someone explain why I am getting this error? What can I do to resolve this error?
    Is any other Jar need other than mail.jar?
    Any help would be much appreciated.
    Regards,
    Nisanth

    Hai EJP,
    Thanks for your reply,
    My full java class as follows,
    import java.util.Properties;
    import javax.mail.Authenticator;
    import javax.mail.Folder;
    import javax.mail.Message;
    import javax.mail.PasswordAuthentication;
    import javax.mail.Session;
    import javax.mail.Store;
    import javax.mail.Part;
    import javax.mail.Multipart;
    import javax.mail.internet.MimeMultipart;
    import javax.mail.internet.MimeMessage;
    public class Newmail
    public Newmail()
    super();
    public static int mailPOP3(String phost,
    String pusername,
    String ppassword)
    Folder inbox =null;
    Store store =null;
    int result = 1;
    try
    String host=phost;
    final String username=pusername;
    final String password=ppassword;
    System.out.println("Authenticator");
    Authenticator auth=new Authenticator()
    protected PasswordAuthentication getPasswordAuthentication()
    return new PasswordAuthentication(username, password);
    System.out.println("Certificate");
    String filename="D:\\Certi\\jssecacerts";
    String password2 = "changeit";
    System.setProperty("javax.net.ssl.trustStore",filename);
    System.setProperty("javax.net.ssl.trustStorePassword",password2);
    Properties props = System.getProperties();
    System.out.println("host-----"+props);
    props.setProperty("mail.pop3s.port", "993");
    props.setProperty("mail.pop3s.starttls.enable","true");
    props.setProperty("mail.pop3s.ssl.trust", "*");
    Session session = Session.getInstance(props,auth);
    session.setDebug(true);
    store = session.getStore("pop3s");
    System.out.println("store------"+store);
    store.connect(host,username,password);
    System.out.println("Connected...");
    inbox = store.getDefaultFolder().getFolder("INBOX");
    inbox.open(Folder.READ_ONLY);
    Message[] msgs = inbox.getMessages();
    System.out.println("msgs.length-----"+msgs.length);
    result = 0;
    int no_of_messages = msgs.length;
    for ( int i=0; i < no_of_messages; i++)
    System.out.println("msgs.count-----"+i);
    System.out.println("Attachment....>"+msgs.getContentType());
    Multipart mp = (Multipart)msgs[i].getContent();
    System.out.println("Casting Success" + mp.getContentType());
    catch(Exception e)
    e.printStackTrace();
    finally
    try
    if(inbox!=null)
    inbox.close(false);
    if(store!=null)
    store.close();
    return result;
    catch(Exception e)
    e.printStackTrace();
    return result;
    Please check it
    Regards,
    Nisanth

  • Oracle Java Mail API exception in Jdev 11.1.15

    we are using java mail api to send out emails. and wrap it in java embedding with in our webservice.
    we are using jdeveloper 11.1.1.5 for this and the Java API is failing with the below error, we have included all the java libraries. As code is working fine in Jdeveloper 11.1.2
    we tried different version of jdeveloper ( 11.1.1.5, 11.1.1.7 ) but its still the same. Can some one please suggest
    Exception in thread "main" java.lang.RuntimeException: javax.mail.MessagingException: Can't send command to SMTP host;
      nested exception is:
        javax.net.ssl.SSLHandshakeException: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
        at bts.mail.SendMailTLS.main(SendMailTLS.java:50)
    Caused by: javax.mail.MessagingException: Can't send command to SMTP host;
      nested exception is:
        javax.net.ssl.SSLHandshakeException: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
        at com.sun.mail.smtp.SMTPTransport.sendCommand(SMTPTransport.java:1420)
        at com.sun.mail.smtp.SMTPTransport.sendCommand(SMTPTransport.java:1408)
        at com.sun.mail.smtp.SMTPTransport.ehlo(SMTPTransport.java:847)
        at com.sun.mail.smtp.SMTPTransport.protocolConnect(SMTPTransport.java:384)
        at javax.mail.Service.connect(Service.java:297)
        at javax.mail.Service.connect(Service.java:156)
        at javax.mail.Service.connect(Service.java:105)
        at javax.mail.Transport.send0(Transport.java:168)
        at javax.mail.Transport.send(Transport.java:98)
        at bts.mail.SendMailTLS.main(SendMailTLS.java:45)

    Can Some body help me with this please

  • Using Java mail API from JSPDynPage

    Hi Experts,
    I am working on a Portal Assignment that requiresto sent work flow mails on the basis of error conditions.
    Can u please suggest if at all I can use Java Mail APIs from JSP page within the JSP DYN Page Framework.
    If at all Java Mail can be used could u please suugest some help docs on the same.
    Thanks for the help.
    Manab C Ghosh
    EP Consultant
    Kolkata INDIA
    +919830603327

    Hi Experts,
    Thanks for all the responses to my Mail question(mailing from JSPDynPage).
    I have found the solution.
    Here is how I have got the things: (pls note there are other solns)
    Using Java Mail APIs;
    Create a Java file in the scr.core / src.api
    MailSender.java
    * Created on Jul 21, 2005
    * To change the template for this generated file go to
    * Window>Preferences>Java>Code Generation>Code and Comments
    package com.mailsend.test;
    import java.util.Date;
    import java.util.Properties;
    import javax.mail.Message;
    import javax.mail.MessagingException;
    import javax.mail.Multipart;
    import javax.mail.Session;
    import javax.mail.Transport;
    import javax.mail.internet.InternetAddress;
    import javax.mail.internet.MimeBodyPart;
    import javax.mail.internet.MimeMessage;
    import javax.mail.internet.MimeMultipart;
    * Edited on Jul 24, 2005
    * @author Manab C Ghosh
    public class MailSender {
         public String sendMessage(){
            String msg ="Hello mail Test";
            String smtpServer ="mySMTPServer";
            String smtpSender = "senderemailaddress";
            String smtpRecipient="receipientemailaddress";
            String stBody =  msg ;
            //String stDate = new Date().toString() ;
            String stSubject = "Mail Test ";
            Send(     smtpServer,          //SMTPServer
                      smtpSender,          //Sender
                      smtpRecipient,     //Recipient
                      stSubject,          //Subject
                      stBody               //Body
                        );               //Attachments                    
         return "Mail Success";
    public static void Send(String SMTPServer,
                                  String From,
                                  String To,
                                  String Subject,
                                  String msgText1
            // Error status;
            int ErrorStatus = 0;
            // create some properties and get the default Session
            Properties props = System.getProperties();
            props.put("mail.smtp.host", SMTPServer);
            Session session = Session.getDefaultInstance(props, null);     
            try {
                 // create a message
                 MimeMessage msg = new MimeMessage(session);
                 msg.setFrom(new InternetAddress(From));
                 InternetAddress[] address = {new InternetAddress(To)};
                 msg.setRecipients(Message.RecipientType.TO, address);
                 msg.setSubject(Subject);
                 // create and fill the first message part
                 MimeBodyPart mbp1 = new MimeBodyPart();
                 mbp1.setText(msgText1);
                 // create the Multipart and its parts to it
                 Multipart mp = new MimeMultipart();
                 mp.addBodyPart(mbp1);
                 //mp.addBodyPart(mbp2);
                 // add the Multipart to the message
                 msg.setContent(mp);
                 // set the Date: header
                 msg.setSentDate(new Date());
                 // send the message
                 Transport.send(msg);
            } catch (MessagingException mex) {
    Call this file from the JSP page (which is set at JSPDynPage controller)
    one important thing-----
    Create a dir under PORTAL-INF and import the following jars-- activation.jar, mail.jar,imap.jar,smtp.jar, mailapi.jar.
    This works..
    Thanks once again to the Experts.
    happy mailing
    Manab Ghosh.
    INDIA (+919830603327)

  • Failed to build Java Mail API 1.4.5 with maven-3.0.4

    Hi,
    I am trying to build Java Mail 1.4.5 with Maven-3.0.4 using default settings of maven.
    It is getting failed to build due to following errors -
    [ERROR] COMPILATION ERROR :
    [INFO] -----------------------------------------------------------
    [ERROR] \Workarea\mySourceData\src\Mail\mail\src\main\java\javax\mail\Session.java:[210,37] cannot find symbol
    symbol : variable Version
    location: class javax.mail.Session
    [ERROR] \Workarea\mySourceData\src\Mail\mail\src\main\java\javax\mail\Session.java:[369,47] cannot find symbol
    symbol : variable Version
    location: class javax.mail.Session
    [ERROR] \Workarea\mySourceData\src\Mail\mail\src\main\java\javax\mail\Session.java:[913,29] cannot find symbol
    symbol : variable Version
    location: class javax.mail.Session
    [ERROR] \Workarea\mySourceData\src\Mail\mail\src\main\java\javax\mail\Session.java:[916,29] cannot find symbol
    symbol : variable Version
    location: class javax.mail.Session
    [ERROR] \Workarea\mySourceData\src\Mail\mail\src\main\java\javax\mail\Session.java:[919,29] cannot find symbol
    symbol : variable Version
    location: class javax.mail.Session
    [ERROR] \Workarea\mySourceData\src\Mail\mail\src\main\java\javax\mail\Session.java:[922,29] cannot find symbol
    symbol : variable Version
    location: class javax.mail.Session
    [ERROR] \Workarea\mySourceData\src\Mail\mail\src\main\java\javax\mail\Session.java:[925,29] cannot find symbol
    symbol : variable Version
    location: class javax.mail.Session
    [ERROR] \Workarea\mySourceData\src\Mail\mail\src\main\java\javax\mail\Session.java:[928,29] cannot find symbol
    symbol : variable Version
    location: class javax.mail.Session
    [INFO] 8 errors
    [INFO] -----------------------------------------------------------
    [INFO] ----------------------------------------------------------------------
    [INFO] BUILD FAILURE
    [INFO] ----------------------------------------------------------------------
    [INFO] Total time: 1:51.197s
    [INFO] Finished at: Tue Jan 08 13:06:01 IST 2013
    [INFO] Final Memory: 12M/67M
    [INFO] ----------------------------------------------------------------------
    [ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:2.
    3.2:compile (default-compile) on project javax.mail: Compilation failure: Compil
    ation failure:
    [ERROR] \Workarea\mySourceData\src\Mail\mail\src\main\java\javax\mail\Session.java:[210,37] cannot find symbol
    [ERROR] symbol : variable Version
    [ERROR] location: class javax.mail.Session
    [ERROR]\Workarea\mySourceData\src\Mail\mail\src\main\java\javax\mail\Session.java:[369,47] cannot find symbol
    [ERROR] symbol : variable Version
    [ERROR] location: class javax.mail.Session
    [ERROR] \Workarea\mySourceData\src\Mail\mail\src\main\java\javax\mail\Session.java:[913,29] cannot find symbol
    [ERROR] symbol : variable Version
    [ERROR] location: class javax.mail.Session
    [ERROR] \Workarea\mySourceData\src\Mail\mail\src\main\java\javax\mail\Session.java:[916,29] cannot find symbol
    [ERROR] symbol : variable Version
    [ERROR] location: class javax.mail.Session
    [ERROR] \Workarea\mySourceData\src\Mail\mail\src\main\java\javax\mail\Session.java:[919,29] cannot find symbol
    [ERROR] symbol : variable Version
    [ERROR] location: class javax.mail.Session
    [ERROR] \Workarea\mySourceData\src\Mail\mail\src\main\java\javax\mail\Session.java:[922,29] cannot find symbol
    [ERROR] symbol : variable Version
    [ERROR] location: class javax.mail.Session
    [ERROR]\Workarea\mySourceData\src\Mail\mail\src\main\java\javax\mail\Session.java:[925,29] cannot find symbol
    [ERROR] symbol : variable Version
    [ERROR] location: class javax.mail.Session
    [ERROR] \Workarea\mySourceData\src\Mail\mail\src\main\java\javax\mail\Session.java:[928,29] cannot find symbol
    [ERROR] symbol : variable Version
    [ERROR] location: class javax.mail.Session
    [ERROR] -> [Help 1]
    org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal o
    rg.apache.maven.plugins:maven-compiler-plugin:2.3.2:compile (default-compile) on
    project javax.mail: Compilation failure
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor
    .java:213)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor
    .java:153)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor
    .java:145)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProje
    ct(LifecycleModuleBuilder.java:84)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProje
    ct(LifecycleModuleBuilder.java:59)
    at org.apache.maven.lifecycle.internal.LifecycleStarter.singleThreadedBu
    ild(LifecycleStarter.java:183)
    at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(Lifecycl
    eStarter.java:161)
    at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:320)
    at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:156)
    at org.apache.maven.cli.MavenCli.execute(MavenCli.java:537)
    at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:196)
    at org.apache.maven.cli.MavenCli.main(MavenCli.java:141)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.
    java:57)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
    sorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:601)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Laun
    cher.java:290)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.jav
    a:230)
    at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(La
    uncher.java:409)
    at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:
    352)
    Caused by: org.apache.maven.plugin.CompilationFailureException: Compilation fail
    ure
    at org.apache.maven.plugin.AbstractCompilerMojo.execute(AbstractCompiler
    Mojo.java:656)
    at org.apache.maven.plugin.CompilerMojo.execute(CompilerMojo.java:128)
    at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(Default
    BuildPluginManager.java:101)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor
    .java:209)
    ... 19 more
    [ERROR]
    [ERROR]
    [ERROR] For more information about the errors and possible solutions, please rea
    d the following articles:
    [ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureExceptionSame issue I am facing when I am trying to build Java Mail with netbeans - 7.2.1, it getting failed with same version issue in Session.java class.
    How can I set this Version in Session.java class to get rid of this error?
    If we can use nexus repository then please let me know how to set this.
    Thanks,
    Neelam Sharma

    I answered this question here:
    http://stackoverflow.com/questions/14217596/failed-to-build-java-mail-api-1-4-5-with-maven-3-0-4/14288418#14288418

  • How to use Java Mail API in Unix

    I am trying to write some code using Java mail API. I want to execute it in Unix. I downloaded the mail API to windows machine and ftped the mail.jar file to a Unix machine. Then I set the class path as below:
    export CLASSPATH=$CLASSPATH:/home.../mail.jar
    Then I tried to compile my Java program. The output is as below:
    error: error reading /home.../mail.jar; invalid END header (bad central directory offset)
    mail.java:1: package javax.mail does not exist
    import javax.mail.*;
    Can any one please help me out.

    You should also include the "activation.jar" file that you obtained from
    downloading the Java Activation Framework, in your CLASSPATH.
    For example:
    export CLASSPATH=$CLASSPATH:/urPath/activation/activation.jar
    Besides, assuming you unzipped javamail-1_4_1.zip in home/download the following should work
    export CLASSPATH=$CLASSPATH:home/download/javamail-1.4.1/mail.jar:.

  • Issue with JAVA Mail API

    Hi
    We have a requirement to create a custom e mail. For the same I am trying to use Java Mail API.I am facing an issue with the following code:
    session session1 = session.getInstance(properties, null);
    System gives an error Sourced file: inline evaluation of: ``Properties props = new Properties(); session session1 = session.getInstance(prop . . . '' : Typed variable declaration : Class: session not found in namespace
    Is there some specific API i need to import for session class. Kindly suggest.
    Regards
    Shobha

    Hi Shobha,
    I was also facing the same issue from last couple of weeks and just now i have achieved the working functionality.
    Please find below working code and replace values as per your serveru2019s configuration.
    import com.sap.odp.api.util.*;
    import java.util.*;
    import javax.mail.*;
    import javax.mail.internet.*;
    import javax.activation.*;
    import java.io.File;
    import java.net.*;
    // SUBSTITUTE YOUR EMAIL ADDRESSES HERE!!!
    String to =<email address>;
    String from =<email address>;
    // SUBSTITUTE YOUR ISP'S MAIL SERVER HERE!!!
    String host = <smtp host name>;
    String user = <smtp user name>;
    // Create properties, get Session
    // Properties props = new Properties();
    Properties props = System.getProperties();
    props.put("mail.transport.protocol", "smtp");
    props.put("mail.smtp.host", host);
    props.put("mail.debug", "false");
    props.put("mail.smtp.auth", "false");
    props.put("mail.user",user);
    props.put("mail.from",from);
    Session d_session = Session.getInstance(props,null);//Authenticator object need to be set
    Message msg = new MimeMessage(d_session);
    msg.setFrom(new InternetAddress(from));
    InternetAddress[] address = {new InternetAddress(to)};
    msg.setRecipients(Message.RecipientType.TO, address);
    msg.setSubject("Test E-Mail through Java");
    msg.setSentDate(new Date());
    msg.setText("This is a test of sending a " +
    "plain text e-mail through Java.\n" +
    "Here is line 2.");
    Transport.send(msg);
    Deepak!!!

  • Java.lang.UnsupportedClassVersionError while using java mail api

    Hi Everybody ,
    I am new comer to this forum , and would like to be an active member.
    I am getting this error while trying to use the java mail api to send an email using smtp.
    The error is as follows :
    Exception in thread "main" java.lang.UnsupportedClassVersionError: javax/mail/Message (Unsupported major.minor version 48.0)
    Can Anyone please tell where I am wrong.
    I am using the following code
    ==============================================================
    Properties props = new Properties();
    props.put("mail.smtp.host", "smtp.abc.com");
    // create some properties and get the default Session
    Session session = Session.getDefaultInstance(props, null);
    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);
    // Optional : You can also set your custom headers in the Email if you Want
    msg.addHeader("MyHeaderName", "myHeaderValue");
    // Setting the Subject and Content Type
    msg.setSubject(subject);
    msg.setContent(message, "text/plain");
    Transport.send(msg);
    ==============================================================

    Hi Philip ,
    Thanks for the prompt reply , I had installed oracle client services which overid my jdk1.4 installation with jdk1.3 and hence the error. I changed my classpath settings to point to jdk1.4 and it owrked properly.
    Thanks once again.
    regards,
    Rupesh Rajan

  • Problem using Java Mail API with WLS 7.0

    Hi All,
    I am trying to use the Java Mail API provided by WLS 7.0. I have made the
    settings metioned in the WLS 7.0 docs. However when I try to run the program I
    am getting the following error:
    javax.naming.NoInitialContextException: Need to specify class name in environment
    or system property, or as an applet parameter, or in an application resource file:
    java.naming.factory.initial
    at javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:6
    46)
    at javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:246
    at javax.naming.InitialContext.getURLOrDefaultInitCtx(InitialContext.jav
    a:283)
    at javax.naming.InitialContext.lookup(InitialContext.java:350)
    The code that I have written is as follows
    import java.util.*;
    import javax.activation.*;
    import javax.mail.*;
    import javax.mail.internet.*;
    import javax.naming.*;
    import java.io.*;
    import java.net.InetAddress;
    import java.util.Properties;
    import java.util.Date;
    public class MailTo {
         public static void main(String args[])
              try
                   //Context ic = getInitialContext();
                   InitialContext ic = new InitialContext();
    /* My jndi name is "testSession" */
                   Session session = (Session) ic.lookup("testSession"); /* THE PROBLEM IS SHOWN
    IN THIS LINE */
                   Properties props = new Properties();
                   props.put("mail.transport.protocol", "smtp");
                   props.put("mail.smtp.host", "XX.XX.XX.XX");
    /* For security reasons I have written the ip add in this format */
                   props.put("mail.from", "[email protected]"); /* for security reasons i have
    changed the mail address */
                   Session session2 = session.getInstance(props);
                   Message msg = new MimeMessage(session2);
                   msg.setFrom();
                   msg.setRecipients(Message.RecipientType.TO, InternetAddress.parse("[email protected]",
    false));
                   msg.setSubject("Test Message");
                   msg.setSentDate(new Date());
                   MimeBodyPart mbp = new MimeBodyPart();
                   mbp.setText("This is a mail sent to you using JAVA Mail API and Weblogic Server");
                   Multipart mp = new MimeMultipart();
                   mp.addBodyPart(mbp);
                   msg.setContent(mp);
                   Transport.send(msg);
              catch(Exception e)
                   e.printStackTrace();
         }//end of main
    public static Context getInitialContext()
         throws NamingException
              Properties p = new Properties();
              p.put(Context.INITIAL_CONTEXT_FACTORY, "weblogic.jndi.WLInitialContextFactory");
              p.put(Context.PROVIDER_URL, "t3://localhost:7501/testWebApp");
                   p.put(Context.SECURITY_PRINCIPAL, "weblogic");
                   p.put(Context.SECURITY_CREDENTIALS, "weblogic");
              return new InitialContext(p);
    }//end of class
    Can anyone please tell me what is the problem. I thought that we cannot directly
    do
    InitialContext ic = new InitialContext();
    So I had written a method getInitialContext() as shown in the above piece of code,
    but that too did not work.
    Eagerly awaiting a response.
    Jimmy Shah

    You can use InitialContext ic = new InitialContext() only if you are using a startup class, servlet or a JSP i.e
    server side code.
    If you are using a java client you need to use Context ic = getInitialContext();
    Try this code
    import java.util.*;
    import javax.activation.*;
    import javax.mail.*;
    import javax.mail.internet.*;
    import javax.naming.*;
    import java.io.*;
    import java.net.InetAddress;
    import java.util.Properties;
    import java.util.Date;
    public class MailTo {
    public static void main(String args[])
    try {
    Properties h = new Properties();
    h.put(Context.INITIAL_CONTEXT_FACTORY,"weblogic.jndi.WLInitialContextFactory");
    h.put(Context.PROVIDER_URL, "t3://localhost:7001");
    Context ic = new InitialContext(h);
    Session session = (Session) ic.lookup("testSession");
    Properties props = new Properties();
    props.put("mail.transport.protocol", "smtp");
    props.put("mail.smtp.host", "XX.XX.XX.XX");
    props.put("mail.from", "[email protected]");
    Session session2 = session.getInstance(props);
    Message msg = new MimeMessage(session2);
    msg.setFrom();
    msg.setRecipients(Message.RecipientType.TO,InternetAddress.parse("[email protected]",false));
    msg.setSubject("Test Message");
    msg.setSentDate(new Date());
    MimeBodyPart mbp = new MimeBodyPart();
    mbp.setText("This is a mail sent to you using JAVA Mail API and Weblogic Server");
    Multipart mp = new MimeMultipart();
    mp.addBodyPart(mbp);
    msg.setContent(mp);
    Transport.send(msg);
    catch(Exception e)
    e.printStackTrace();
    }//end of main
    }//end of class
    We have shipped a javamail example in the samples\server\src\examples\javamail folder.
    Jimmy Shah wrote:
    Hi All,
    I am trying to use the Java Mail API provided by WLS 7.0. I have made the
    settings metioned in the WLS 7.0 docs. However when I try to run the program I
    am getting the following error:
    javax.naming.NoInitialContextException: Need to specify class name in environment
    or system property, or as an applet parameter, or in an application resource file:
    java.naming.factory.initial
    at javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:6
    46)
    at javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:246
    at javax.naming.InitialContext.getURLOrDefaultInitCtx(InitialContext.jav
    a:283)
    at javax.naming.InitialContext.lookup(InitialContext.java:350)
    The code that I have written is as follows
    import java.util.*;
    import javax.activation.*;
    import javax.mail.*;
    import javax.mail.internet.*;
    import javax.naming.*;
    import java.io.*;
    import java.net.InetAddress;
    import java.util.Properties;
    import java.util.Date;
    public class MailTo {
    public static void main(String args[])
    try
    //Context ic = getInitialContext();
    InitialContext ic = new InitialContext();
    /* My jndi name is "testSession" */
    Session session = (Session) ic.lookup("testSession"); /* THE PROBLEM IS SHOWN
    IN THIS LINE */
    Properties props = new Properties();
    props.put("mail.transport.protocol", "smtp");
    props.put("mail.smtp.host", "XX.XX.XX.XX");
    /* For security reasons I have written the ip add in this format */
    props.put("mail.from", "[email protected]"); /* for security reasons i have
    changed the mail address */
    Session session2 = session.getInstance(props);
    Message msg = new MimeMessage(session2);
    msg.setFrom();
    msg.setRecipients(Message.RecipientType.TO, InternetAddress.parse("[email protected]",
    false));
    msg.setSubject("Test Message");
    msg.setSentDate(new Date());
    MimeBodyPart mbp = new MimeBodyPart();
    mbp.setText("This is a mail sent to you using JAVA Mail API and Weblogic Server");
    Multipart mp = new MimeMultipart();
    mp.addBodyPart(mbp);
    msg.setContent(mp);
    Transport.send(msg);
    catch(Exception e)
    e.printStackTrace();
    }//end of main
    public static Context getInitialContext()
    throws NamingException
    Properties p = new Properties();
    p.put(Context.INITIAL_CONTEXT_FACTORY, "weblogic.jndi.WLInitialContextFactory");
    p.put(Context.PROVIDER_URL, "t3://localhost:7501/testWebApp");
    p.put(Context.SECURITY_PRINCIPAL, "weblogic");
    p.put(Context.SECURITY_CREDENTIALS, "weblogic");
    return new InitialContext(p);
    }//end of class
    Can anyone please tell me what is the problem. I thought that we cannot directly
    do
    InitialContext ic = new InitialContext();
    So I had written a method getInitialContext() as shown in the above piece of code,
    but that too did not work.
    Eagerly awaiting a response.
    Jimmy Shah--
    Rajesh Mirchandani
    Developer Relations Engineer
    BEA Support

  • Problem with sending mail throgh java mail api

    hi folks,
    We are having problem regarding sending mail using java mail api.
    we are using msgsendsample.java file from demo folder contained in javamail-1.3.3_01 folder.
    we are using following command at dos prompt.:
    java msgsendsample [email protected] [email protected] smtp.mail.yahoo.com false
    It gives following Exception:
    --Exception handling in msgsendsample.java
    com.sun.mail.smtp.SMTPSendFailedException: 530 authentication required - for hel
    p go to http://help.yahoo.com/help/us/mail/pop/pop-11.html
    at com.sun.mail.smtp.SMTPTransport.issueSendCommand(SMTPTransport.java:1
    333) at com.sun.mail.smtp.SMTPTransport.mailFrom(SMTPTransport.java:906)
    at com.sun.mail.smtp.SMTPTransport.sendMessage(SMTPTransport.java:535)
    at javax.mail.Transport.send0(Transport.java:151)
    at javax.mail.Transport.send(Transport.java:80)
    at msgsendsample.main(msgsendsample.java:93)
    ** ValidUnsent Addresses
    [email protected]
    Thanking in Advance...
    Please give us guidance to any alternate solution if exists.

    hi
    the smtp server u are using should allow u to send mail to other smtp server like if u r sending mail to yahoo account u have to use yahoo smtp server only .....
    bye

Maybe you are looking for

  • Automatic Replication of Vendors from SAP R/3 Backend System to SRM System

    Hi All, I am searching for any existing standard configuration in SRM V 4.0 System for replicating Vendors of selected Purchasing Organizations from SAP R/3 Backend System to SRM System. I have checked in the SPRO  settings of SRM System and found/co

  • How to get self in a JDialog button action method?

    The following code is written in the init() of a JDialog(jdialog1). I want to create another JDialog(jdialog2) when the user clicks a button in jdialog1. but i couldn't get jdialog1 itself to form the parameters of creating jdialog2. i.e. 'this' in t

  • TS3694 iphone could not be restored. an unknown error 1015 has occured.. what to do now??

    My iphone could not be restored. it shows that an unknown error has occured (1015). How to restore my iphone from a recovery mode?

  • Metadata info entry

    I'm organizing all my images and I need to add metadata information to the images.  The data that i need to enter is common to all the images in a folder so how can I enter the info to more than one image at the same time?  Can I add it to the folder

  • Pse for mac

    I have just downloaded the trial version of pse for mac. I have previously used - very successfully - both photoshop elements and premiere elements on my sony vaio. My question is - will I be able to make slideshows in the same way as I did on the Va