Java mail Transport.send()
I'm getting a cryptic message when I call Transport.send(messag_object):
no provider for address type: rfc822
exception thrown in non-transactional ejb invoke:
com.ssga.exception.MailManagerException
I am using a stateless session bean to do the work.
This call to Transport.send() is the last line in the EJB method before returning.
Thanks
Paul Dudley
[email protected]
Also make sure that you have tha activation.jar.
Regards,
Eric
"Jim Typrowicz" <[email protected]> wrote in message
news:[email protected]..
>
I found a reference to a mail problem in the Newsgroup. It said that WLSis missing
two files. I downloaded the mail.jar from sun and put it in front of theweblogic.jar
file and now the e-mail works.
"Jim Typrowicz" <[email protected]> wrote:
I'm getting the same error. If you find something out please let me
know, and
I'll do likewise. Thanks.
"Paul Dudley" <[email protected]> wrote:
I'm getting a cryptic message when I call Transport.send(messag_object):
no provider for address type: rfc822
exception thrown in non-transactional ejb invoke:
com.ssga.exception.MailManagerException
I am using a stateless session bean to do the work.
This call to Transport.send() is the last line in the EJB method before
returning.
Thanks
Paul Dudley
[email protected]
Similar Messages
-
How to use java mail to send email to hotmail box
how to use java mail to send email to hotmail box??
i can send emails to other box(my company's email account) but for hotmail, the program didnt print any err or exception the recepient cant receive the mail.
thanksyou ust to download activation.jar and mail.jar and add them to your build path.
i have used the googlemail smtp server to send mail the code is following:
public void SendMail()
Properties props = new Properties();
props.put("mail.smtp.user", username);
props.put("mail.smtp.host", host);
props.put("mail.smtp.port", port);
props.put("mail.smtp.starttls.enable","true");
props.put("mail.smtp.auth", "true");
props.put("mail.smtp.socketFactory.port", port);
try{
Authenticator auth = new SMTPAuthenticator(username,password);
Session session = Session.getInstance(props, auth);
MimeMessage msg = new MimeMessage(session);
msg.setText(text);
msg.setSubject(subject);
msg.setFrom(new InternetAddress(senderEmail));
msg.addRecipient(Message.RecipientType.TO, new InternetAddress(receiver));
Transport.send(msg);
}catch(Exception ex) {
System.out.println("Error Sending:");
System.out.println(ex.getMessage().toString());
and this the SMTPAuthenticator Class which you will need too.
class SMTPAuthenticator extends javax.mail.Authenticator {
private String fUser;
private String fPassword;
public SMTPAuthenticator(String user, String password) {
fUser = user;
fPassword = password;
public PasswordAuthentication getPasswordAuthentication() {
return new PasswordAuthentication(fUser, fPassword);
} -
Java mail api - sending mails to gmail account
Hello
I am using java mail api to send mails.when i send mails to gmail from ids which are not in gmail friends list, most of the mails are going to spam.Ofcourse, some of them go to inbox.I tried in lot of ways to analyse the problem.But nothing could help. Can anyone plzz tell me how to avoid mails going to spam in gmail, using java mail api?
Thank you in advance,
Regards,
Aradhana
Message was edited by:
Aradhanaam using the below code.
Properties props = System.getProperties();
// Setup mail server
props.put("mail.smtp.host", smtpHost);
props.put("mail.smtp.port","25");
props.put("mail.smtp.auth", isAuth);
Authenticator auth = new UserAuthenticator();
// Get session
Session s = Session.getDefaultInstance(props,auth);
// Define message
Message m = new MimeMessage(s);
// setting message attributes
try {
m.setRecipient(Message.RecipientType.TO, new InternetAddress(to));
InternetAddress f_addr=new InternetAddress(from);
f_addr.setPersonal(personalName);
m.setFrom(f_addr);
m.setSubject(subject);
m.setSentDate(new Date());
m.setContent(msg,"text/plain");
m.saveChanges();
// send message
Transport.send(m);
Message was edited by:
Aradhana -
Java mail Gmail send and receive messages
Dear All
can any body send me java mail api TESTED code for send and receive gmail messages. There are may sample code on net are available but I am failed to find solution. Please help
I will be very thank full to you
regards
AamirNo. This is not a free coding service. It is a user to user forum. The general idea is that you ask questions about code you have already written. If you want tested code you generally have to pay for it. Locking this thread, for later deletion.
-
Problem in sending mail for a pop3 account using transport.send(msg)
hi,
i am having problem in not able to send mail for a pop3 account ...
I have written an email gateway which listens to my pop3 account...on email arrival it listens nd extract the contents and send it as an sms msg...upon failure it needs to deliver the mail to sender id.I am using quartz to listen.
i am using jboss for server and java mail api.
here is my code
MimeMessage mimemsg = new MimeMessage(session);
mimemsg.setFrom();
mimemsg.setRecipients(Message.RecipientType.TO, to);
mimemsg.setSubject(subject);
mimemsg.setText(parsedText);
mimemsg.setSentDate(new Date());
mimemsg.setContent(strBuff.toString(), "text/html");
System.out
.println("Before sending mail");
Transport.send(m);
System.out.println("message sent successfully");
excepition i am getting is :
2008-09-12 11:45:11,140 INFO [STDOUT] Before sending mail
2008-09-12 11:45:11,140 ERROR [STDERR] javax.mail.IllegalWriteException: POP3 messages are read-only
2008-09-12 11:45:11,140 ERROR [STDERR] at com.sun.mail.pop3.POP3Message.saveChanges(POP3Message.java:438)
2008-09-12 11:45:11,140 ERROR [STDERR] at javax.mail.Transport.send(Transport.java:97)
2008-09-12 11:45:11,140 ERROR [STDERR] at com.openstream.emailgateway.sources.ListenEmailGateway.execute(ListenEmailGateway.java:422)
2008-09-12 11:45:11,140 ERROR [STDERR] at sun.reflect.GeneratedMethodAccessor89.invoke(Unknown Source)
2008-09-12 11:45:11,140 ERROR [STDERR] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
2008-09-12 11:45:11,140 ERROR [STDERR] at java.lang.reflect.Method.invoke(Method.java:585)
2008-09-12 11:45:11,140 ERROR [STDERR] at org.jboss.invocation.Invocation.performCall(Invocation.java:359)
2008-09-12 11:45:11,140 ERROR [STDERR] at org.jboss.ejb.MessageDrivenContainer$ContainerInterceptor.invoke(MessageDrivenContainer.java:495)
2008-09-12 11:45:11,140 ERROR [STDERR] at org.jboss.resource.connectionmanager.CachedConnectionInterceptor.invoke(CachedConnectionInterceptor.java:158)
2008-09-12 11:45:11,140 ERROR [STDERR] at org.jboss.ejb.plugins.MessageDrivenInstanceInterceptor.invoke(MessageDrivenInstanceInterceptor.java:116)
2008-09-12 11:45:11,140 ERROR [STDERR] at org.jboss.ejb.plugins.CallValidationInterceptor.invoke(CallValidationInterceptor.java:63)
2008-09-12 11:45:11,140 ERROR [STDERR] at org.jboss.ejb.plugins.AbstractTxInterceptor.invokeNext(AbstractTxInterceptor.java:121)
2008-09-12 11:45:11,140 ERROR [STDERR] at org.jboss.ejb.plugins.TxInterceptorCMT.runWithTransactions(TxInterceptorCMT.java:350)
2008-09-12 11:45:11,140 ERROR [STDERR] at org.jboss.ejb.plugins.TxInterceptorCMT.invoke(TxInterceptorCMT.java:181)
2008-09-12 11:45:11,140 ERROR [STDERR] at org.jboss.ejb.plugins.RunAsSecurityInterceptor.invoke(RunAsSecurityInterceptor.java:109)
2008-09-12 11:45:11,140 ERROR [STDERR] at org.jboss.ejb.plugins.LogInterceptor.invoke(LogInterceptor.java:205)
2008-09-12 11:45:11,140 ERROR [STDERR] at org.jboss.ejb.plugins.ProxyFactoryFinderInterceptor.invoke(ProxyFactoryFinderInterceptor.java:138)
2008-09-12 11:45:11,140 ERROR [STDERR] at org.jboss.ejb.MessageDrivenContainer.internalInvoke(MessageDrivenContainer.java:402)
2008-09-12 11:45:11,140 ERROR [STDERR] at org.jboss.ejb.Container.invoke(Container.java:960)
2008-09-12 11:45:11,140 ERROR [STDERR] at sun.reflect.GeneratedMethodAccessor88.invoke(Unknown Source)
2008-09-12 11:45:11,140 ERROR [STDERR] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
2008-09-12 11:45:11,140 ERROR [STDERR] at java.lang.reflect.Method.invoke(Method.java:585)
2008-09-12 11:45:11,140 ERROR [STDERR] at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:155)
2008-09-12 11:45:11,140 ERROR [STDERR] at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)
2008-09-12 11:45:11,171 ERROR [STDERR] at org.jboss.mx.server.Invocation.invoke(Invocation.java:86)
2008-09-12 11:45:11,171 ERROR [STDERR] at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
2008-09-12 11:45:11,171 ERROR [STDERR] at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
2008-09-12 11:45:11,171 ERROR [STDERR] at org.jboss.invocation.local.LocalInvoker$MBeanServerAction.invoke(LocalInvoker.java:169)
2008-09-12 11:45:11,171 ERROR [STDERR] at org.jboss.invocation.local.LocalInvoker.invoke(LocalInvoker.java:118)
2008-09-12 11:45:11,171 ERROR [STDERR] at org.jboss.invocation.InvokerInterceptor.invokeLocal(InvokerInterceptor.java:209)
2008-09-12 11:45:11,171 ERROR [STDERR] at org.jboss.invocation.InvokerInterceptor.invoke(InvokerInterceptor.java:195)
2008-09-12 11:45:11,171 ERROR [STDERR] at org.jboss.proxy.TransactionInterceptor.invoke(TransactionInterceptor.java:61)
2008-09-12 11:45:11,171 ERROR [STDERR] at org.jboss.ejb.plugins.inflow.MessageEndpointInterceptor.delivery(MessageEndpointInterceptor.java:263)
2008-09-12 11:45:11,171 ERROR [STDERR] at org.jboss.ejb.plugins.inflow.MessageEndpointInterceptor.invoke(MessageEndpointInterceptor.java:140)
2008-09-12 11:45:11,171 ERROR [STDERR] at org.jboss.proxy.ClientMethodInterceptor.invoke(ClientMethodInterceptor.java:74)
2008-09-12 11:45:11,171 ERROR [STDERR] at org.jboss.proxy.ClientContainer.invoke(ClientContainer.java:100)
2008-09-12 11:45:11,171 ERROR [STDERR] at $Proxy73.execute(Unknown Source)
2008-09-12 11:45:11,171 ERROR [STDERR] at org.jboss.resource.adapter.quartz.inflow.QuartzJob.execute(QuartzJob.java:57)
2008-09-12 11:45:11,171 ERROR [STDERR] at org.quartz.core.JobRunShell.run(JobRunShell.java:203)
2008-09-12 11:45:11,171 ERROR [STDERR] at org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:520)
2008-09-12 11:45:11,171 INFO [STDOUT] USer flag ..[Ljava.lang.String;@115c6cbas i am writing the message failure details to a template...
//on failure to send messages , reply to the sender about the failure
strBuff= tempDetail.writeToTemplate(smsmsg);
is that bcoz i am getting an exception -
Java mail api: SendFailedException when trying to send Mail via SMTP
Hello,
I'm trying to send a mail via java mail api using a server that requires smtp authentication.
I'm currently using the following code:
protocol = "smtp";
host = "auth.smtp.profimailer.de";
port = 25;
String from="[email protected]";
String to="[email protected]";
props.put("mail.smtp.host", host);
props.put("mail.smtp.auth", "true");
Authenticator auth = new PopupAuthenticator();
session=Session.getInstance(props,auth);
MimeMessage message = new MimeMessage(session);
message.setFrom(new InternetAddress(from,"[email protected]"));
message.addRecipient(Message.RecipientType.TO,new InternetAddress(to,"ToName"));
message.setSubject("Hello JavaMail");
message.setText("Welcome to JavaMail");
Transport.send(message);
static class PopupAuthenticator extends Authenticator {
public PasswordAuthentication getPasswordAuthentication() {
return new PasswordAuthentication("e12345676", "mypass");
}When trying to run this code, I get the following exception:
D:\eclipse30RC1\workspace\ClassifyIt\bin>java -cp .;../lib/javamail.jar de.jwannenmacher.classify.TestMail > test.txt
javax.mail.SendFailedException: Send failed;
nested exception is:
javax.mail.SendFailedException: Sender "[email protected]" <jens
@jens-wannenmacher.de> was rejected: 501
at javax.mail.Transport.doSend(Transport.java:223)
at javax.mail.Transport.send(Transport.java:92)
at de.jwannenmacher.mail.pop3client.POP3Client.getAllNewMessages(POP3Cli
ent.java:176)
at de.jwannenmacher.classify.TestMail.main(TestMail.java:22)
Any suggestions on this?
Thanks and best regards,
JensHi,
yes smtp is a standard and I think you could use this with almost every smtp server.
If your smtp server doesn't require authentication you can access it without an authenticator
I think...
Best regards,
Jens -
Sending HTML E Mail using Java Mail
Can anybody please tell me how to send HTML email using JavaMail. I know I need the DataContentHandler for text/html mime type but where can I find one? If anybody has better suggestions you are welcome.
Folks,
I've used what you have suggested. Though it compiled, I kept getting this java error
--Exception in MailServer.java
javax.mail.SendFailedException: Sending failed;
nested exception is:
javax.mail.MessagingException: IOException while sending message;nested exception is:
javax.activation.UnsupportedDataTypeException: no object DCH for MIME type text/html
at javax.mail.Transport.send0(Transport.java:204)
at javax.mail.Transport.send(Transport.java:73)
at MailTest.send(MailTest.java:419)
at MailTest.sendThruDefaultServer(MailTest.java:319)
at MailTest.main(MailTest.java:476)
[sendEmail() - Exception :javax.activation.UnsupportedDataTypeException
HELP! -
Not able to sending the Mail using java mail utility
Hi, I am new to java mail utility and written first time for sending mail. If any body an help me out in resolving the problem I would be thankful to him/her........below is the code which I m trying......
package test;
import javax.servlet.http.HttpServlet;
import java.util.Properties;
import javax.mail.*;
import javax.mail.internet.AddressException;
import javax.mail.internet.InternetAddress;
import javax.mail.internet.MimeMessage;
/*import javax.mail.Address;
import javax.mail.Authenticator;
import javax.mail.MessagingException;
import javax.mail.NoSuchProviderException;
import javax.mail.PasswordAuthentication;
import javax.mail.Session;
import javax.mail.Transport;
import javax.mail.Message.RecipientType;
import javax.mail.internet.AddressException;
import javax.mail.internet.InternetAddress;
import javax.mail.internet.MimeMessage;*/
* @author chauhasd
* TODO To change the template for this generated type comment go to
* Window - Preferences - Java - Code Style - Code Templates
public class SendMailServlet extends HttpServlet{
public SendMailServlet(){
public void sendMail(){
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.host","pcsttc.patni.com");
props.put("mail.smtp.port","25");
props.put("mail.smtp.auth","true");
props.put("mail.smtp.starttls.enable","true");
Session session=Session.getDefaultInstance(props,new MyAuthenticator());
session.setDebug(true);
MimeMessage message=new MimeMessage(session);
try{
message.setContent("Hello....","text/plain");
message.setSubject("Testing Mail");
Address strTo = new InternetAddress("[email protected]");
Address strFrom = new InternetAddress("[email protected]");
Address strReplyTO = new InternetAddress("[email protected]");
message.setFrom(strFrom);
message.setReplyTo(new Address[]{strReplyTO});
message.setRecipient(Message.RecipientType.TO,strTo);
Transport.send(message);
}catch (AddressException e)
// TODO Auto-generated catch block
e.printStackTrace();
}catch (NoSuchProviderException e){
// TODO Auto-generated catch block
e.printStackTrace();
}catch (MessagingException e){
// TODO Auto-generated catch block
e.printStackTrace();
protected PasswordAuthentication getPasswordAuthentication()
return new PasswordAuthentication("[email protected]", "sid35789");
public static void main(String [] args){
new SendMailServlet().sendMail();
ERROR :
DEBUG: setDebug: JavaMail version 1.3.1
DEBUG: getProvider() returning javax.mail.Provider[TRANSPORT,smtp,com.sun.mail.smtp.SMTPTransport,Sun Microsystems, Inc]
DEBUG SMTP: useEhlo true, useAuth true
javax.mail.SendFailedException: Sending failed;
nested exception is:
class javax.mail.AuthenticationFailedException
at javax.mail.Transport.send0(Transport.java:218)
at javax.mail.Transport.send(Transport.java:80)
at test.SendMailServlet.sendMail(SendMailServlet.java:59)
at test.SendMailServlet.main(SendMailServlet.java:81)Sangyesh wrote:
In my application,we already implemented it so we cant go for javamail.That does not make sense. Your 'implementation' does not work so you have not yet fully 'implemented' it. Using Javamail takes about 4 lines of code to do what you have done so far and it will work.
Please suggest me regarding this,so that I can go ahead and resolve it.Use the Javamail API. -
Problems while sending mail using java mail..help...
Hello all,
I am new to Java Mail...
Below is my first program...
Can anybody tell what's wrong in it..??
Thanks in advance....
------------------------------------------------------start--------------------
package test;
import java.util.Properties;
import javax.mail.Address;
import javax.mail.Authenticator;
import javax.mail.MessagingException;
import javax.mail.NoSuchProviderException;
import javax.mail.PasswordAuthentication;
import javax.mail.Session;
import javax.mail.Transport;
import javax.mail.Message.RecipientType;
import javax.mail.internet.AddressException;
import javax.mail.internet.InternetAddress;
import javax.mail.internet.MimeMessage;
public class Send
public Send()
public void send()
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.host","smtp.gmail.com");
props.put("mail.smtp.port","25");
props.put("mail.smtp.auth","true");
Session session=Session.getDefaultInstance(props,new MyAuthenticator());
session.setDebug(true);
MimeMessage message=new MimeMessage(session);
try
message.setContent("Hello ...","text/plain");
message.setSubject("Test mail...plz don't ignore..");
Address to=new InternetAddress("[email protected]");
Address from=new InternetAddress("[email protected]");
Address replyTo=new InternetAddress("[email protected]");
message.setFrom(from);
message.setReplyTo(new Address[]{replyTo});
message.setRecipient(RecipientType.TO,to);
Transport.send(message);
} catch (AddressException e)
// TODO Auto-generated catch block
e.printStackTrace();
} catch (NoSuchProviderException e)
// TODO Auto-generated catch block
e.printStackTrace();
} catch (MessagingException e)
// TODO Auto-generated catch block
e.printStackTrace();
public static void main(String[] args)
new Send().send();
class MyAuthenticator extends Authenticator
MyAuthenticator()
super();
protected PasswordAuthentication getPasswordAuthentication()
return new PasswordAuthentication("[email protected]", "*******");
--------------------------------------------end--------------
here is the output.....
DEBUG: setDebug: JavaMail version 1.3.2
DEBUG: getProvider() returning javax.mail.Provider[TRANSPORT,smtp,com.sun.mail.smtp.SMTPTransport,Sun Microsystems, Inc]
DEBUG SMTP: useEhlo true, useAuth true
DEBUG SMTP: useEhlo true, useAuth true
DEBUG SMTP: trying to connect to host "smtp.gmail.com", port 25, isSSL false
220 mx.gmail.com ESMTP 16sm2443823wrl
DEBUG SMTP: connected to host "smtp.gmail.com", port: 25
EHLO jijo
250-mx.gmail.com at your service
250-SIZE 20971520
250-8BITMIME
250-STARTTLS
250 ENHANCEDSTATUSCODES
DEBUG SMTP: Found extension "SIZE", arg "20971520"
DEBUG SMTP: Found extension "8BITMIME", arg ""
DEBUG SMTP: Found extension "STARTTLS", arg ""
DEBUG SMTP: Found extension "ENHANCEDSTATUSCODES", arg ""
DEBUG SMTP: use8bit false
MAIL FROM:<[email protected]>
530 5.7.0 Must issue a STARTTLS command first
com.sun.mail.smtp.SMTPSendFailedException: 530 5.7.0 Must issue a STARTTLS command first
at com.sun.mail.smtp.SMTPTransport.issueSendCommand(SMTPTransport.java:1275)
at com.sun.mail.smtp.SMTPTransport.mailFrom(SMTPTransport.java:895)
at com.sun.mail.smtp.SMTPTransport.sendMessage(SMTPTransport.java:524)
at javax.mail.Transport.send0(Transport.java:151)
at javax.mail.Transport.send(Transport.java:80)
at test.Send.send(Send.java:50)
at test.Send.main(Send.java:68)
QUIT
com.sun.mail.smtp.SMTPSendFailedException: 530 5.7.0 Must issue a STARTTLS command first
at com.sun.mail.smtp.SMTPTransport.issueSendCommand(SMTPTransport.java:1275)
at com.sun.mail.smtp.SMTPTransport.mailFrom(SMTPTransport.java:895)
at com.sun.mail.smtp.SMTPTransport.sendMessage(SMTPTransport.java:524)
at javax.mail.Transport.send0(Transport.java:151)
at javax.mail.Transport.send(Transport.java:80)
at test.Send.send(Send.java:50)
at test.Send.main(Send.java:68)
Can any body help me..??
Thanks and Regards
Jijo vincentHi All,
I am new to javax.mail.
I have attached my code and also error here...
can anyone help to resolve the error?
Code:
public class MailExample {
public static void main(String args[]) {
try {
String host = "localhost"; //args[0];
String from = "[email protected]"; //args[1];
// String to = "[email protected]";//args[2];
String to = "[email protected]";//args[2];
java.security.Security.addProvider(new com.sun.net.ssl.internal.ssl.Provider());
// Get system properties
Properties props = System.getProperties();
// Setup mail server
props.put("mail.smtp.host", host);
props.put("mail.smtp.starttls.enable","true");
//props.put("mail.smtp.auth","true");
// Get session
Session session = Session.getDefaultInstance(props, null);
session.setDebug(true);
// Define message
MimeMessage message = new MimeMessage(session);
// Set the from address
message.setFrom(new InternetAddress(from));
// Set the to address
message.addRecipient(Message.RecipientType.TO, new InternetAddress(to));
// Set the subject
message.setSubject("Hello JavaMail");
// Set the content
message.setText("Welcome to JavaMail");
// Send message
Transport.send(message);
catch(AddressException ae){
ae.printStackTrace();
}catch (MessagingException e)
// TODO Auto-generated catch block
e.printStackTrace();
Error:
DEBUG: setDebug: JavaMail version 1.3.3ea
DEBUG: getProvider() returning javax.mail.Provider[TRANSPORT,smtp,com.sun.mail.smtp.SMTPTransport,Sun Microsystems, Inc]
DEBUG SMTP: useEhlo true, useAuth false
DEBUG SMTP: trying to connect to host "localhost", port 25, isSSL false
220 localhost
DEBUG SMTP: connected to host "localhost", port: 25
EHLO HDCHCTDAM33726
250-localhost
250 HELP
DEBUG SMTP: Found extension "HELP", arg ""
DEBUG SMTP: use8bit false
MAIL FROM:<[email protected]>
250 [email protected] Address Okay
RCPT TO:<[email protected]>
250 [email protected] Address Okay
DEBUG SMTP: Verified Addresses
DEBUG SMTP: [email protected]
DATA
354 Start mail input; end with <CRLF>.<CRLF>
Message-ID: <10736847.01125315340863.JavaMail.sangeetham@HDCHCTDAM33726>
From: [email protected]
To: [email protected]
Subject: Hello JavaMail
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Welcome to JavaMail
com.sun.mail.smtp.SMTPSendFailedException: 550 Invalid recipient: [email protected]
at com.sun.mail.smtp.SMTPTransport.issueSendCommand(SMTPTransport.java:1333)
at com.sun.mail.smtp.SMTPTransport.finishData(SMTPTransport.java:1160)
at com.sun.mail.smtp.SMTPTransport.sendMessage(SMTPTransport.java:538)
at javax.mail.Transport.send0(Transport.java:151)
at javax.mail.Transport.send(Transport.java:80)
at org.worldbank.webmfr.util.MailExample.main(MailExample.java:55)550 Invalid recipient: [email protected]
com.sun.mail.smtp.SMTPSendFailedException: 550 Invalid recipient: [email protected]
at com.sun.mail.smtp.SMTPTransport.issueSendCommand(SMTPTransport.java:1333)
at com.sun.mail.smtp.SMTPTransport.finishData(SMTPTransport.java:1160)
at com.sun.mail.smtp.SMTPTransport.sendMessage(SMTPTransport.java:538)
at javax.mail.Transport.send0(Transport.java:151)
at javax.mail.Transport.send(Transport.java:80)
at org.worldbank.webmfr.util.MailExample.main(MailExample.java:55)
QUIT -
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 -
Error of using Java Mail in Web Start
Hi,
I got a problem when using Java Mail to send email. My apps is a stand alone and no problem when it was deployed normally. When I used the Web Start to deploy it, the following error was caught when I tried to send email:
javax.activation.UnsupportedDataTypeException: no object DCH for MIME type multipart/mixed; boundary="----=_Part_0_2824645.1032281188963"
at javax.activation.ObjectDataContentHandler.writeTo(DataHandler.java:851)
at javax.activation.DataHandler.writeTo(DataHandler.java:305)
at javax.mail.internet.MimeBodyPart.writeTo(MimeBodyPart.java:1089)
at javax.mail.internet.MimeMessage.writeTo(MimeMessage.java:1527)
at com.sun.mail.smtp.SMTPTransport.sendMessage(SMTPTransport.java:321)
at javax.mail.Transport.send0(Transport.java:164)
at javax.mail.Transport.send(Transport.java:81)
at com.mailcom.client.util.EMail.sendMail(EMail.java:180)
Here is the source code:
public class EMail {
public static void sendMail(String host,
String sender,
String recipient,
String subject,
String content,
Vector fileNames) throws MessagingException {
Properties props = new Properties();
props.put("mail.smtp.host",host);
Session session = Session.getDefaultInstance(props,null);
session.setDebug(true);
Message msg = new MimeMessage(session);
msg.setFrom(new InternetAddress(sender));
msg.setRecipients(Message.RecipientType.TO, InternetAddress.parse(recipient,false));
msg.setSubject(subject);
Multipart mp = new MimeMultipart();
// create and fill the first message part
MimeBodyPart mbp1 = new MimeBodyPart();
mbp1.setText(content);
mp.addBodyPart(mbp1);
// attach the file to the message
if(fileNames != null && fileNames.size() != 0) {
FileDataSource fds = null;
for(int i = 0; i < fileNames.size(); i++ ) {
String currentFileName = (String)fileNames.elementAt(i);
fds = new FileDataSource(currentFileName);
// create the second message part
MimeBodyPart mbp2 = new MimeBodyPart();
mbp2.setDataHandler(new DataHandler(fds));
mbp2.setFileName(fds.getName());
// create the Multipart and its parts to it
mp.addBodyPart(mbp2);
// add the Multipart to the message
msg.setContent(mp);
msg.setHeader("X-Mailer",MAILER);
// set the Date: header
msg.setSentDate(new Date());
// send the message
line 180 Transport.send(msg);Yes. All the third party jar files and our application jar are put on the server side. Here is the JNLP file:
<?xml version="1.0" encoding="utf-8"?>
<!-- JNLP File for software-->
<jnlp spec="1.0+" codebase="http://www.software.com/apps" href="client.JNLP">
<information>
<title>client application</title>
<vendor> * </vendor>
<homepage href="docs/help.html"/>
<description>Client</description>
<description kind="short">A tool</description>
<icon href="images/logo.jpg"/>
<offline-allowed/>
</information>
<security>
<all-permissions/>
</security>
<resources>
<j2se version="1.3"/>
<jar href="lib/client.jar"/>
<jar href="lib/mail.jar"/>
<jar href="lib/smtp.jar"/>
<jar href="lib/activation.jar"/>
</resources>
<application-desc main-class="com.software.client.MainFrame">
<argument>2226</argument>
<argument>www.software.com</argument>
<argument>5351</argument>
</application>
</jnlp> -
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
-
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 moreIt's a configuration error in your smtp server.
See the JavaMail FAQ for more information. -
Hi i had prepared a java program to send an attachment file it was compiled but when i interpret then it would show the error message as follows
PLEASE HELP ME
javax.mail.MessagingException: Unknown SMTP host: true;
nested exception is:
java.net.UnknownHostException: true
at com.sun.mail.smtp.SMTPTransport.openServer(SMTPTransport.java:1280)
at com.sun.mail.smtp.SMTPTransport.protocolConnect(SMTPTransport.java:37
0)
at javax.mail.Service.connect(Service.java:275)
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 sendfile.postFile(sendfile.java:129)
at sendfile.main(sendfile.java:60)
Caused by: java.net.UnknownHostException: true
at java.net.PlainSocketImpl.connect(Unknown Source)
at java.net.SocksSocketImpl.connect(Unknown Source)
at java.net.Socket.connect(Unknown Source)
at java.net.Socket.connect(Unknown Source)
at com.sun.mail.util.SocketFetcher.createSocket(SocketFetcher.java:232)
at com.sun.mail.util.SocketFetcher.getSocket(SocketFetcher.java:189)
at com.sun.mail.smtp.SMTPTransport.openServer(SMTPTransport.java:1250)
... 8 more
java.net.UnknownHostException: true
at java.net.PlainSocketImpl.connect(Unknown Source)
at java.net.SocksSocketImpl.connect(Unknown Source)
at java.net.Socket.connect(Unknown Source)
at java.net.Socket.connect(Unknown Source)
at com.sun.mail.util.SocketFetcher.createSocket(SocketFetcher.java:232)
at com.sun.mail.util.SocketFetcher.getSocket(SocketFetcher.java:189)
at com.sun.mail.smtp.SMTPTransport.openServer(SMTPTransport.java:1250)
at com.sun.mail.smtp.SMTPTransport.protocolConnect(SMTPTransport.java:37
0)
at javax.mail.Service.connect(Service.java:275)
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 sendfile.postFile(sendfile.java:129)
at sendfile.main(sendfile.java:60)
aND MY SOURCE CODE IS
import java.util.*;
import java.io.*;
import javax.mail.*;
import javax.mail.internet.*;
import javax.activation.*;
public class SendingFile
static String SMTP_HOST_NAME = "smtp.gmail.com";
static String SMTP_AUTH_USER = "xxxx";
static String emailSubjectTxt = "From xxx S/W";
static String SMTP_AUTH_USER = "xxx";
static String SMTP_AUTH_PWD = "xxxxx";
static String emailFromAddress = "xxxx ";
static StringBuffer sb = new StringBuffer();
static String[] emailList = {"[email protected]", "[email protected]"};
static String filename = "user.htm";
public static void main(String args[]) throws Exception
SendingFile smtpMailSender = new SendingFile();
smtpMailSender.postMail( emailList, emailSubjectTxt, emailFromAddress, filename);
// create some properties and get the default Session
for(int i = 0; i<emailList.length; i++)
System.out.println("Sucessfully Sent mail to All Users"+emailList);
public void postMail( String recipients[ ], String message , String from, String filename) throws MessagingException
boolean debug = false;
Properties props = new Properties();
props.put("mail.smtp.host", SMTP_HOST_NAME);
props.put("mail.smtp.host", "true");
Authenticator auth = new SMTPAuthenticator();
Session session = Session.getDefaultInstance(props, auth);
session.setDebug(debug);
// create a message
MimeMessage msg = new MimeMessage(session);
msg.setFrom(new InternetAddress(from));
InternetAddress[] addressTo = new InternetAddress[recipients.length];
for (int i = 0; i < recipients.length; i++)
addressTo[i] = new InternetAddress(recipients[i]);
msg.setRecipients(Message.RecipientType.TO, addressTo);
// msg.setSubject(message);
// create and fill the first message part
MimeBodyPart mbp1 = new MimeBodyPart();
mbp1.setText(message);
// create the second message part
MimeBodyPart mbp2 = new MimeBodyPart();
// attach the file to the message
FileDataSource fds = new FileDataSource(filename);
mbp2.setDataHandler(new DataHandler(fds));
mbp2.setFileName(fds.getName());
// create the Multipart and add 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);
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);
Message was edited by:
muthu2007
Message was edited by:
muthu2007props.put("mail.smtp.host", SMTP_HOST_NAME);
props.put("mail.smtp.host", "true");Remove the second line...
Christian -
First Java Mail Program...some problems
Hi Friends,
I am new to JavaMail and i am trying to follow the following exercise:
http://java.sun.com/developer/onlineTraining/JavaMail/exercises/MailSetup/
I am using rogers high speed internet connection,so i enter the following:
D:\JAVAWORLD\javamail1.3.2-src\src\share\classes\demo>java msgsend -o [email protected] -M smtp.broadband.rogers.com [email protected]
To: [email protected]
Subject: hi
Welcome
^ZI get the following error:
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
275)
at com.sun.mail.smtp.SMTPTransport.mailFrom(SMTPTransport.java:895)
at com.sun.mail.smtp.SMTPTransport.sendMessage(SMTPTransport.java:524)
at javax.mail.Transport.send0(Transport.java:151)
at javax.mail.Transport.send(Transport.java:80)
at msgsend.main(msgsend.java:165)When i went to that yahoo link for help,there are no settings for command line.Please tell me how to accomplish this..friendsThanks Ananda,
But i guess,i should be able to access the rogers smtp server,because i have them as my isp.Moreover,it works fine with my outlook too.I even tried to use a free smtp server called "dumbster",i downladed it but i dont know how to use it.If anyone has some idea,please let me know.
Thanks
Maybe you are looking for
-
Creative ZEN MX (1.04.01)
Creative ZEN MX (.04.0)ZThe new firmware features an option (System > Display Settings > Backlight Time) that allow you to dim the backlight minimum every 5 seconds, but never completely turn off to save battery, unless you have auto lock setting on
-
I have a bit of an issue that was created when I upgraded my PC to Windows 8 where the installation did not work correctly on the first attempt and had to do the whole thing again, but as a result all of my programs where removed so effectively meant
-
Call flex remoteObject data in a loop
here is simple explanation, I need to show some panel and some buttons in that panel. consider we have 5 panels, so i use for loop for 1 to 5. inside that panels Button name comes from java using remoteObject and blazeds. Now my problem is remote obj
-
Step by step procedure to connect SAP XI(Seerburger adapter) wi EDI partner
hi, I need to know what kind of scenario we have go with seerburger adapter to connect with EDI partner? give some example scenarios and step by step procedure to connect SAP XI(Seerburger adapter) with EDI partner? regards Ruban Message was edited
-
Apply Filter to static content
Hi, I am writing a filter very similar to the one outlined in http://developer.java.sun.com/developer/JDCTechTips/2001/tt0626.html#tip2. I would like this filter to be applied to all static content on the web server. I have found a problem that the f