[prev in list] [next in list] [prev in thread] [next in thread]
List: jakarta-commons-user
Subject: Re: [EMAIL]-[Error In Sending Email Using Commons Email API]
From: jitesh dundas <jiteshbdundas () gmail ! com>
Date: 2009-07-22 12:36:32
Message-ID: a609fe70907220524o60ae1a6dy288d3f801a508742 () mail ! gmail ! com
[Download RAW message or body]
Hi Siegfried,
Thank you for your reply. I will try that out.
Regards,
Jitesh
On Wed, Jul 22, 2009 at 12:56 PM, Siegfried Goeschl <
siegfried.goeschl@it20one.at> wrote:
> Hi folks,
>
> this is not a commons-email issue but the SMTP server decides to reject
> the email due to
>
> "<jiteshbdundas@gmail.com>: Relay access denied"
>
> and this is actually a message from the SMTP server
>
> It seems that your mail server is not set up to relay mails to the
> public - to verify that point send an email to "jitesh@it.iitb.ac.in"
> because no relaying is required. You can also set the debug mode using
> Email.setDebug(true) to see the messages being exchanged between your
> client and SMTP server.
>
> Cheers,
>
> Siegfried Goeschl
>
> jitesh dundas wrote:
> > Hi Andres,
> >
> > I did that too.
> >
> > Code Used:-
> > --------------------------
> > import java.io.*;
> > import java.net.InetAddress;
> > import java.util.Properties;
> > import java.util.Date;
> >
> > import javax.mail.*;
> > import javax.mail.internet.*;
> > import javax.activation.*;
> >
> > import org.apache.commons.mail.*;
> >
> > public class sendCommonsMail
> > {
> >
> > public static void main( String args[])
> > {
> > int flagmailesent = 1;
> >
> > try
> > {
> > org.apache.commons.mail.SimpleEmail em = new
> > org.apache.commons.mail.SimpleEmail();
> > em.setHostName("smtp-auth.iitb.ac.in");
> > em.setSmtpPort(25);
> > em.setAuthentication("jitesh","jitesh*");
> > em.addTo("jiteshbdundas@gmail.com");
> > em.setFrom("jitesh@it.iitb.ac.in");
> > em.setSubject("Test Mail Using Commons API");
> > em.setMsg("Simple Test Mail");
> > em.send();
> > }
> > catch( org.apache.commons.mail.EmailException emailex)
> > {
> > System.out.println("Commons Exception="+emailex);
> > emailex.printStackTrace();
> > }
> > }
> > }
> > -------------------------
> > Error :-
> >
> > -------------------------
> > C:\Program Files\Java\jdk1.5.0_10\bin>java sendCommonsMail
> > Commons Exception=org.apache.commons.mail.EmailException: Sending the
> email
> > to t
> > he following server failed : smtp-auth.iitb.ac.in:25
> > org.apache.commons.mail.EmailException: Sending the email to the
> following
> > serve
> > r failed : smtp-auth.iitb.ac.in:25
> > at org.apache.commons.mail.Email.sendMimeMessage(Email.java:1138)
> > at org.apache.commons.mail.Email.send(Email.java:1163)
> > at sendCommonsMail.main(sendCommonsMail.java:29)
> > Caused by: javax.mail.SendFailedException: Invalid Addresses;
> > nested exception is:
> > com.sun.mail.smtp.SMTPAddressFailedException: 554
> > <jiteshbdundas@gmail.c
> > om>: Relay access denied
> >
> > at
> com.sun.mail.smtp.SMTPTransport.rcptTo(SMTPTransport.java:1446)
> > at
> > com.sun.mail.smtp.SMTPTransport.sendMessage(SMTPTransport.java:736)
> > at javax.mail.Transport.send0(Transport.java:191)
> > at javax.mail.Transport.send(Transport.java:120)
> > at org.apache.commons.mail.Email.sendMimeMessage(Email.java:1128)
> > ... 2 more
> > Caused by: com.sun.mail.smtp.SMTPAddressFailedException: 554
> > <jiteshbdundas@gmai
> > l.com>: Relay access denied
> >
> > at
> com.sun.mail.smtp.SMTPTransport.rcptTo(SMTPTransport.java:1344)
> > ... 6 more
> >
> > C:\Program Files\Java\jdk1.5.0_10\bin>
> > ------------------------
> >
> > Are there any connection./network settings on my machine and/or the SMTP
> > Server to be set..
> >
> > Regards,
> > Jitesh
> >
> > 2009/7/21 Andrés M. Luna <andres@digiworks.com.mx>
> >
> >
> >> Hi,
> >>
> >> Is your smtp port: 80??
> >> ...
> >> email.setSmtpPort(80);
> >> ...
> >>
> >> Try using port: 25
> >> ...
> >> email.setSmtpPort(25);
> >> ...
> >>
> >> Regards,
> >> Andres M. Luna
> >>
> >> -----Original Message-----
> >> From: jitesh dundas [mailto:jiteshbdundas@gmail.com]
> >> Sent: Tuesday, July 21, 2009 7:17 AM
> >> To: user@commons.apache.org
> >> Subject: [EMAIL]-[Error In Sending Email Using Commons Email API]
> >>
> >> Dear Friends,
> >>
> >> I am using the Commons Mail API. The code mentioned below is compiling
> fine
> >> but it gives the run time error:-
> >>
> >> Code :-
> >> ---------------------
> >> import java.io.*;
> >> import java.net.InetAddress;
> >> import java.util.Properties;
> >> import java.util.Date;
> >>
> >> import javax.mail.*;
> >> import javax.mail.internet.*;
> >> import javax.activation.*;
> >>
> >> import org.apache.commons.mail.*;
> >>
> >> public class sendCommonsMail
> >> {
> >>
> >> public static void main( String args[])
> >> {
> >> int flagmailesent = 1;
> >>
> >> try
> >> {
> >> SimpleEmail email = new SimpleEmail();
> >> email.setHostName("****-****.****.**.**");
> >> email.setSmtpPort(80);
> >> email.setAuthentication("******","*******");
> >> email.addTo("jiteshbdundas@gmail.com");
> >> email.setFrom("jitesh@it.iitb.ac.in");
> >> email.setSubject("Test Mail Using Commons API");
> >> email.setMsg("Simple Test Mail");
> >> email.send();
> >> }
> >> catch( org.apache.commons.mail.EmailException emailex)
> >> {
> >> System.out.println("Commons Exception="+emailex);
> >> emailex.printStackTrace();
> >> }
> >> }
> >> }
> >> --------------------
> >>
> >>
> >> Error :-
> >> ----------------------
> >> C:\Program Files\Java\jdk1.5.0_10\bin>java sendCommonsMail
> >> Commons Exception=org.apache.commons.mail.EmailException: Sending the
> email
> >> to t
> >> he following server failed : smtp-auth.iitb.ac.in:80
> >> org.apache.commons.mail.EmailException: Sending the email to the
> following
> >> serve
> >> r failed : smtp-auth.iitb.ac.in:80
> >> at org.apache.commons.mail.Email.sendMimeMessage(Email.java:1138)
> >> at org.apache.commons.mail.Email.send(Email.java:1163)
> >> at sendCommonsMail.main(sendCommonsMail.java:29)
> >> Caused by: javax.mail.MessagingException: Could not connect to SMTP
> host:
> >> smtp-a
> >> uth.iitb.ac.in, port: 80;
> >> nested exception is:
> >> java.net.ConnectException: Connection timed out: connect
> >> at
> >> com.sun.mail.smtp.SMTPTransport.openServer(SMTPTransport.java:1545)
> >> at
> >> com.sun.mail.smtp.SMTPTransport.protocolConnect(SMTPTransport.java:45
> >> 3)
> >> at javax.mail.Service.connect(Service.java:313)
> >> at javax.mail.Service.connect(Service.java:172)
> >> at javax.mail.Service.connect(Service.java:121)
> >> at javax.mail.Transport.send0(Transport.java:190)
> >> at javax.mail.Transport.send(Transport.java:120)
> >> at org.apache.commons.mail.Email.sendMimeMessage(Email.java:1128)
> >> ... 2 more
> >> Caused by: java.net.ConnectException: Connection timed out: connect
> >> at java.net.PlainSocketImpl.socketConnect(Native Method)
> >> at java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:333)
> >> at
> >> java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:195)
> >> at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:182)
> >> at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:366)
> >> at java.net.Socket.connect(Socket.java:519)
> >> at java.net.Socket.connect(Socket.java:469)
> >> at
> >> com.sun.mail.util.SocketFetcher.createSocket(SocketFetcher.java:267)
> >> at
> com.sun.mail.util.SocketFetcher.getSocket(SocketFetcher.java:227)
> >> at
> >> com.sun.mail.smtp.SMTPTransport.openServer(SMTPTransport.java:1511)
> >> ... 9 more
> >>
> >> C:\Program Files\Java\jdk1.5.0_10\bin>
> >> ---------------------
> >>
> >> Please help.
> >>
> >> Thanks & Regards,
> >> Jitesh Dundas
> >>
> >>
> >> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
> >> For additional commands, e-mail: user-help@commons.apache.org
> >>
> >>
> >>
> >
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
> For additional commands, e-mail: user-help@commons.apache.org
>
>
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic