JavaMail sendingemail & mail server
Hi, all.
I recently try to use javamail.
and i get the code from internet:
this is the code :
<%
java.util.Properties props = new java.util.Properties();
// props.clear();
// props.remove("mail.smtp.host");
props.put("mail.smtp.host","127.0.0.1");
javax.mail.Session s = javax.mail.Session.getDefaultInstance(props,null);
s.setDebug(true);
javax.mail.Message msg = new javax.mail.internet.MimeMessage(s);
javax.mail.internet.InternetAddress addressFrom = new javax.mail.internet.InternetAddress ("[email protected]");
msg.setFrom(addressFrom);
javax.mail.internet.InternetAddress addressTo = new javax.mail.internet.InternetAddress ("[email protected]");
msg.setRecipient(javax.mail.Message.RecipientType.TO,addressTo);
msg.setSubject("HALO");
msg.setContent("<H1>Hallo</H1>","text/plain");
javax.mail.Transport tr = s.getTransport("smtp");
tr.send(msg);
// Setup mail server
%>i confused about this code
props.put("mail.smtp.host","127.0.0.1");how to know what is my mail server name ?
i really don't know about this.
i use IIS 5.1
i success to send email without error message but when i tried to look the email, it didn't exist.
can someone help me ?
Thanks
Thanks guys, i have succeed to sen email using javaMail.
I thinks it's not working but, turn out that my email at plasa.com maybe having some difficulties or another reason, i don't know.
Similar Messages
-
Can I use JavaMail without Mailing Server??
Dear All,
My name is Jonathan Wong, a final year student.
I am going to develop an internet application for my final year project that contains a part to sent e-mails by using JavaMail.
Can I use JavaMail without setting up any Mail Server?? If no, can I use the ISP one?? Also, how can I retreive the mailing list from database to JavaMail?? Please advise.
Thanks in advance.
Best Wishes
JonathanYou dont neend to set up a Mail server , You just have to connect to the desired mail server to send and retreive mails............. You should read the Javamail Api , you will find all the classes and required methods there ,, to retreive and send emails........
-
JavaMail SMTP TLS attempt gives SSLHandshakeException on Domino mail server
Javamail TLS smtp (port 25) delivery attempts results in SSLHandshakeException on Domino mail server.
They are however successful on SendMail and Exchange servers.
Privately signed certificates from all three had been added to the keystore.
Thunderbird client is able to send TLS mail successfully through the Domino Server. Additionally the MD5 hash of the cert on IE prompt during Thunderbird delivery matches against the Domino's cert already in keystore.
JavaMail's smtp debug hangs at :
250 Ready to start TLS
EHLO [client name]
Appreciate any feedback..OK, I think I've found a clue.
When 10.6 server was released, there was an Apple article to fix some log messages that were occurring. Here is an excerpt:
*The Mail Server mail.log may contain encryption warnings after upgrading to Mac OS X Server v10.6.
*For example, warnings such as these may appear in the mail.log:
* warning: no entropy source specified with parameter tlsrandomsource
* warning: encryption keys etc. may be predictable
*For improved encryption in Mac OS X Server v10.6, and to avoid this issue, open Terminal and execute this *command:
*sudo postconf -e tlsrandomsource=/dev/urandom
I've found that if you comment out this line in main.cf:
tlsrandomsource = /dev/urandom (at the very end of the file for me)
then TLS will start up OK. It will display the warning messages in the apple article above, but it starts up and handles TLS !!
Next step is to figure out what broke in the random source and fix the encryption warnings. Anyone want to take a stab at this? -
RE: Using JavaMail with JSP when access relay is denied on smtp mail server
Could someone please let me know how to get around the problem of sending an automatic email from a JSP when access relay is denied by the smtp mail server. Could it be that the username and password just needs to be added somewhere???
Any thoughts on how to solve this problem would be greatly appreciated.
Thank you!I know what you are talking about because I setup no relay on my mail server. I understand why you need to supply a username and password because if the server doesn't allow relay, then you must supply a username and password. Doing it by IP address wouldn't work because you have to know the IP address of all people accessing that page. I am in the same boat as you and once I find out the answer, you'll be the first to know. There is one quick workaround. Get your Net Admin to create a user specifically for the page you plan to send from. Get him to allow relaying for that one user. That worked on my setup and like I said, I'm setup the same way you are. Thanks, J
-
Error: The e-mail server could not be reached when the system was trying to
Dear All,
I've configured the Mail Transport in Portal successfully with SMTP as MS Exchange Server and Third-party Mailing servers. But due to some licensing issues a new MS Exchange mail server have been setup replacing the existing ones.
And when i configure the Mail Transport in the system i get the below message on the eMail Window:
"Error: The e-mail server could not be reached when the system was trying to send the message!
javax.mail.MessaginException: 530 5.7.1 Client ws not authenticated
I've configured (all the steps) the same way as i used to before and restarted the server as well! Please let me know the issue to be resolved, the telnet to the mailserver is also successful. I've try'd searching SDN, didn't find the exact solution... any notes on this?
Thanks,
MSHi,
It will depend on your infrastructure, I am not sure and have limited knowledge on netowrks, but in my current landscape both the system were in same domain, but still i had to maintain proxy configuration.
Since it giving authentication error, it feel it could be proxy error.
Please refer below links which talks about same error :
http://java.sun.com/products/javamail/FAQ.html#smtpauth
Or else i think it is issue with port.
Regards,
Jigar Oza
Edited by: jigar oza on Jul 6, 2010 12:43 PM -
Mail Server for windows...
Is there any free mail server for windows that i could use to send emails from my application..
Its just that I have been trying the JavaMail Api and having no luck, despite help from some of you.
And my deadline is closing in and I am no closer to the solution...
There has to be a fast and simple way to send a simple email automatically...anyone know it?
pleaseeee help........I am in college and can use the mail server here no problem...its name is "gabriel.ul.ie", anyone know have any sample code for sending mail, and i could try this with this mailhost...
-
A very simple question: how to obtain the mail server name?
In our JSP application, at one point an email will be sent to notify one event. Currently, that is done by using the html tag: mailto. To have more control on the email in tems of context format (a bad layout right now) and others. I would like to have it processed at servlet by using the JavaMail API, so that it have a nice format and have the sender's email address right in case email client is not installed in the machine where the browser in. The JavaMail API is straight forward. The question is how to obtain the mail server name, and the sender's email address if there is one?
Thanks.
v.How to obtain the mail server's name? It's your server, you should know its name. Or if it isn't your server, you should ask the administrator for its name. Point is, you need to decide in advance what server you are going to use and hard-code its name into the program or into a properties file.
And how to obtain the client's e-mail address? You have to ask the client, probably by putting a box in the HTML and asking them to type it. -
Creating accounts and receiving email from a mail server
Hi,
I'm wanting to create a web application that creates a new email account for a user when they sign-up on my website. My application will process any email that is sent to that email address and extract parts of the email to store in a database.
I think I can use JavaMail to poll the email accounts for new emails which will then be parsed and inserted into my database but I don't know how to programmatically create the email account for each user. I'm looking at using either sendmail or postfix as my mail server and this is on either *nix or os x.
Any advice/pointers to Java APIs would be appreciated. If there's nothing available in Java that can do this kind of thing I'd love to hear about other solutions people know of or think might work :)
Thanks!
- EHi there!
Do the following
message.setFlag(Flags.Flag.DELETED,true);
folder.close(true);
store.close();
these 3 statements will delete email from the mail server.
get back to me after u try this.
ciao
vivek -
James Mail Server Password Encoding From PHP
Hi,
I am writing a PHP website server administration component for the MYSQL database used by James Mail server.
When I encode the password in PHP using MD5, Crypt, SHA, SHA1 or use MSQL encoding functions (MD5 or SHA) when I try to send mail to the Java server it keeps telling me "ERROR smtpserver: AUTH method LOGIN failed".
1)In PHP what encoding should I use so the JavaMail API can encode the authentication the same way?
2) If I want to use no encoding what code do I put in the pwdAlgorithm field?
PHP Version 5.2.6
Apache 2.0 Handler
James 2.3.1
Regards,
Jaco
Edited by: Buglish on Mar 4, 2009 10:59 PM
Edited by: Buglish on Mar 4, 2009 11:05 PMThis is a interaction with Java thus who better to ask then the people that work with JavaMail password encryption all the time.
What I am trying to solve is to find out the encryption format of James. Does James encrypt the passwords itself when a new mailbox is created or JavaMail's security class?
You will notice my second question is what code does james or javamail use when no encryption is used. (e.g. pwdAlgorithm). This field is the MySQL field used to store the encryption type.
James still has to encrypt the password in the format which is specified to verify the password.
Thus my main question, why does PHP encoding not match James's encoding?
In PHP the same encoding format should be used.
PHP uses :
SHA1 - RFC 3174 - US Secure Hash Algorithm 1 (SHA1)
MD5 - RSA Data Security, Inc. MD5 Message-Digest Algorithm
Edited by: Buglish on Mar 5, 2009 12:24 AM -
Exception when fetch message from pop3 mail server
below exception occur whenever i fetched message from pop3 mail server. Its occur for perticular message. so i catched javax.mail.MessagingException but this is not working and rest of the messages skips.
plz help me , its urgent.
javax.mail.MessagingException: error loading POP3 headers;
nested exception is:
java.io.IOException: Unexpected response: ------=_NextPart_000_01B9_01C8
A1AB.148BE090
at com.sun.mail.pop3.POP3Message.loadHeaders(POP3Message.java:467)
at com.sun.mail.pop3.POP3Message.getHeader(POP3Message.java:275)
at javax.mail.internet.MimeMessage.getSubject(MimeMessage.java:717)
at fetch1.<init>(fetch1.java:92)
at fetch1.main(fetch1.java:185)
Caused by: java.io.IOException: Unexpected response: ------=_NextPart_000_01B9_0
1C8A1AB.148BE090
at com.sun.mail.pop3.Protocol.simpleCommand(Protocol.java:361)
at com.sun.mail.pop3.Protocol.multilineCommand(Protocol.java:373)
at com.sun.mail.pop3.Protocol.top(Protocol.java:271)
at com.sun.mail.pop3.POP3Message.loadHeaders(POP3Message.java:451)
... 4 more
Press any key to continue...Code :-
import java.util.*;
import java.io.*;
import javax.mail.*;
import javax.mail.Flags.*;
import javax.mail.internet.*;
import javax.activation.*;
public class fetch3
fetch3()
try
// Setup properties
Properties props = System.getProperties();
props.put("mail.pop3.host","myMailserver ip");
// Setup authentication, get session
Authenticator auth = new PopupAuthenticator();
Session session = Session.getDefaultInstance(props, auth);
// Get the store
Store store = session.getStore("pop3");
store.connect();
// Get folder
Folder folder = store.getFolder("INBOX");
folder.open(Folder.READ_WRITE);
Flags flag = folder.getPermanentFlags();
// Get directory
Message message[] = folder.getMessages();
// Display from (only first) and subject of messages
for (int i=0, n=message.length; i<n; i++)
System.out.println ("------------------------------------------------------");
System.out.println(" From : "+message.getFrom()[0]);
System.out.println(" To : "+message[i].getAllRecipients()[0]+" "+message[i].getAllRecipients().length);
System.out.println(" Replyto : "+message[i].getReplyTo()[0]);
System.out.println(" Subject : "+message[i].getSubject());
System.out.println ("type "+message[i].getContent());
Part messagePart=message[i];
Object content=messagePart.getContent();
// -- or its first body part if it is a multipart message --
if (content instanceof Multipart)
messagePart=((Multipart)content).getBodyPart(0);
// System.out.println("[ Multipart Message ]");
// -- Get the content type --
String contentType=messagePart.getContentType();
// -- If the content is plain text, we can print it --
System.out.println("CONTENT:"+contentType);
if (contentType.startsWith("text/plain") || contentType.startsWith("text/html") || contentType.startsWith("multipart/alternative"))
InputStream is = messagePart.getInputStream();
BufferedReader reader
=new BufferedReader(new InputStreamReader(is));
String thisLine=reader.readLine();
while (thisLine!=null)
System.out.println(thisLine);
thisLine=reader.readLine();
System.out.println ("------------------------------------------------------");
// Close connection
folder.close(false);
store.close();
catch(Exception e)
e.printStackTrace();
public static void main(String s[])
new fetch3();
Regards
Sagar
Edited by: sagar_birari on 23 Apr, 2008 1:18 PM
Edited by: sagar_birari on 23 Apr, 2008 4:30 PMit shows below output
C:\>java -Dmail.debug=true fetch1
DEBUG: JavaMail version 1.4ea
DEBUG: java.io.FileNotFoundException: C:\Program Files\Java\jre1.5.0_06\lib\java
mail.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 Microsyste
ms, Inc], com.sun.mail.smtp.SMTPTransport=javax.mail.Provider[TRANSPORT,smtp,com
.sun.mail.smtp.SMTPTransport,Sun Microsystems, Inc], com.sun.mail.imap.IMAPSSLSt
ore=javax.mail.Provider[STORE,imaps,com.sun.mail.imap.IMAPSSLStore,Sun Microsyst
ems, Inc], com.sun.mail.pop3.POP3SSLStore=javax.mail.Provider[STORE,pop3s,com.su
n.mail.pop3.POP3SSLStore,Sun Microsystems, Inc], com.sun.mail.imap.IMAPStore=jav
ax.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.POP
3Store,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[STOR
E,imap,com.sun.mail.imap.IMAPStore,Sun Microsystems, Inc], smtps=javax.mail.Prov
ider[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.S
MTPTransport,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: java.io.FileNotFoundException: C:\Program Files\Java\jre1.5.0_06\lib\java
mail.address.map (The system cannot find the file specified)
DEBUG: getProvider() returning javax.mail.Provider[STORE,pop3,com.sun.mail.pop3.
POP3Store,Sun Microsystems, Inc]
DEBUG POP3: connecting to host "pop3_server_ip", port 110, isSSL false
S: +OK Hello there.
C: USER [email protected]
S: +OK Password required.
C: PASS mypass
S: +OK logged in.
DEBUG: setDebug: JavaMail version 1.4ea
C: STAT
S: +OK 16 143077
C: NOOP
S: +OK Yup.Edited by: sagar_birari on 24 Apr, 2008 1:16 PM
Edited by: sagar_birari on 24 Apr, 2008 1:18 PM -
Is there any technique to ask Java to connect to mail server?
The Problem is: I would like to use Java Technique to create some mail account on one mail server!
You can use the JavaMail api to send and receive email but not for creating accounts... AFAIK creating a mail account is not standardized in any RFC and depends very much on your mail server.
-
Please a program to connect to IMAP mail server
Hi All,
I am using the following program to connect to my organization's imap mail server..
import javax.mail.*;
import javax.mail.internet.*;
import java.util.*;
public class readm
public static void main(String args[]) throws MessagingException
Properties props =System.getProperties();
props.put("mail.imap.host","gwes.wide.corp.gwes.com " );
Session session = Session.getDefaultInstance(props, null);
session.setDebug(true);
Store store = session.getStore("imap");
System.out.println("IMAP");
store.connect("gwes.wide.corp.gwes.com ", 25 , "user", "password");
}and get the below exception..
DEBUG: setDebug: JavaMail version 1.4.1
DEBUG: getProvider() returning javax.mail.Provider[STORE,imap,com.sun.mail.imap.IMAPStore,Sun Microsystems, Inc]
DEBUG: mail.imap.fetchsize: 16384
IMAP
220 gwes.wide.corp.gwes.com Microsoft ESMTP MAIL Service, Version: 6.0.3790.3959 ready at Sat, 6 Sep 2008 18:07:06 -0400
Exception in thread "main" javax.mail.MessagingException: 220 gwes.wide.corp.gwes.com Microsoft ESMTP MAIL Service, Version: 6.0.3790.3959 ready at Sat, 6 Sep 2008 18:07:06 -0400 ;
nested exception is:
com.sun.mail.iap.ConnectionException: 220 gwes.wide.corp.gwes.com Microsoft ESMTP MAIL Service, Version: 6.0.3790.3959 ready at Sat, 6 Sep 2008 18:07:06 -0400
at com.sun.mail.imap.IMAPStore.protocolConnect(IMAPStore.java:569)
at javax.mail.Service.connect(Service.java:288)
at readm.main(readm.java:16)
Caused by: com.sun.mail.iap.ConnectionException: 220 gwes.wide.corp.gwes.com Microsoft ESMTP MAIL Service, Version: 6.0.3790.3959 ready at Sat, 6 Sep 2008 18:07:06 -0400
at com.sun.mail.imap.protocol.IMAPProtocol.processGreeting(IMAPProtocol.java:230)
at com.sun.mail.iap.Protocol.<init>(Protocol.java:114)
at com.sun.mail.imap.protocol.IMAPProtocol.<init>(IMAPProtocol.java:104)
at com.sun.mail.imap.IMAPStore.protocolConnect(IMAPStore.java:538)
... 2 moreI have posted this already in Java Essentials > Java Programming
but I have not got any solution there. Please help me to correct this code or else give me a code that you feel work with an imap mail server at all conditions , I am running this code in unix. Any help would be a great one....
Advance thanks..Thankyou for trying to help me...
bshannon wrote:
The FAQ has debugging tips for debugging connection problems.
Did you try them? What happened?Please find in my code.. I have set debuggging(session.setDebug(true);)
I tried to telnet Here is the output
telnet gwes.wide.corp.gwes.com 25
Trying 148.86.36.29...
Connected to gwes.wide.corp.gwes.com .
Escape character is '^]'.
220 gwes.wide.corp.gwes.com Microsoft ESMTP MAIL Service, Version: 6.0.3790.3959 ready at Thu, 4 Sep 2008 16:53:24 -0400
quit
221 2.0.0 gwes.wide.corp.gwes.com Service closing transmission channel
Connection closed by foreign host.This means the server accepts conection through port 25. is not it?
"Conection refused" usually means one of:
1. There's no IMAP server on that host.
2. The IMAP server only accepts connections on the secure port.
3. There's a firewall preventing you from connecting.So when I use the 25 port explicitly, I am not getting any conection refused exception, so I need not analyze for the solution in the lines of connection refused. am I right ?
Advance Thanks.. -
Which mail server is used in a webapp?
Hi all,
I have a Webapp where the users can send an email
to me including the parameters of a form
( <form action="mailto:[email protected])....>
<input type="hidden" name="param1" value="xx"/>
Now depending on which mail client the user has on his machine the resulting email differs, sometimes the parameters as 1 attachment, sometimes xx attachments.
So I want to implement it with javamail-api.
MY question: I have to tell the API the name of the mailserver. How can I know what mail-server the user uses? Or are all these emails processed through my own mail-server?
Please help me to understand it. Thanks a lot in advance,
PeterHey ho.
You have to hardconde the mail servers in your code to point to the mail server you use (= your ISP's server) or host (= Your own mailserver). All the mails are then processed through that specified server. -
Urgent!!!! Problem in sending mail through yahoo mail server
Hi
I have a yahoo account and I want to send email through yahoo mail server
using my java program. My program supports SMTP server authentication.
But when I connect to the yahoo mail server(smtp.mail.yahoo.com) I got this error
javax.mail.MessagingException: 521 yahoo.com closing transmission channel. You
must be pop-authenticated before you can use this smtp server, and you must use
your yahoo mail address for the Sender/From field.
This is my program
import javax.mail.*;
import java.util.*;
import javax.mail.internet.*;
import javax.mail.event.*;
import java.io.*;
public class JavaMailUserAgent
Properties properties;
Session session;
Message message;
JavaMailUserAgent(String mailHost,String smtpUsername,String smtpPassword) throws Exception
properties=new Properties();
properties.put("mail.smtp.host",mailHost);
ServerAuthenticate auth=new ServerAuthenticate(smtpUsername,smtpPassword);
session=Session.getInstance(properties,auth);
message=new MimeMessage(session);
} //**********************************************************************end constructor
void sendMail(String messageFrom,String messageTo,String subject,String messageBody) throws Exception
properties.put("mail.from",messageFrom);
InternetAddress[] address={ new InternetAddress(messageTo) };
message.setFrom(new InternetAddress(messageFrom));
message.setRecipients(Message.RecipientType.TO,address);
message.setSubject(subject);
message.setContent(messageBody,"text/plain");
Transport transport=session.getTransport(address[0]);
transport.addConnectionListener(new ConnectionHandler());
transport.addTransportListener(new TransportHandler());
transport.connect();
transport.sendMessage(message,address);
} //*************************************************************************end function
} //*************************************************************************************end main
class ConnectionHandler extends ConnectionAdapter
public void opened(ConnectionEvent e)
System.out.println("connection opened");
public void disconnected(ConnectionEvent e)
System.out.println("connection disconnected");
public void closed(ConnectionEvent e)
System.out.println("connection closed");
} //*************************************************************************************end main
class TransportHandler extends TransportAdapter
public void messageDelivered(TransportAdapter e)
System.out.println("message delivered");
public void messageNotDelivered(TransportAdapter e)
System.out.println("message NOT delivered");
public void messagePartiallyDelivered(TransportAdapter e)
System.out.println("message partially delivered");
} //*************************************************************************************end main
class ServerAuthenticate extends Authenticator
String smtpUsername = null;
String smtpPassword = null;
public ServerAuthenticate(String username, String password)
smtpUsername = username;
smtpPassword = password;
protected PasswordAuthentication getPasswordAuthentication()
return new PasswordAuthentication(smtpUsername,smtpPassword);
} //*************************************************************************************end main
I use this code to call the program.
JavaMailUserAgent jmail=new JavaMailUserAgent("smtp.mail.yahoo.com","my_yahoo_username","my_yahoo_password");
jmail.sendMail("[email protected]","[email protected]","test subject","test message");
Could you pls tell me why do I get this error eventhough My program has server authentication.
Is this my program error.Please Helpl me what to do to correct this problem.
Please include a sample code
thanks for listening
sabuI have used the code below to send mail from yahoo account,but I got the error message like below,what I should configure in pop3 of yahoo account????
import javax.mail.*;
import java.util.*;
import javax.mail.internet.*;
import javax.mail.event.*;
import java.io.*;
public class JavaMailUserAgent
Properties properties;
Session session;
Message message;
JavaMailUserAgent(String mailHost,String smtpUsername,String smtpPassword) throws Exception
properties=new Properties();
properties.put("mail.smtp.host",mailHost);
ServerAuthenticate auth=new ServerAuthenticate(smtpUsername,smtpPassword);
session=Session.getInstance(properties,auth);
message=new MimeMessage(session);
//**********************************************************************end constructor
void sendMail(String messageFrom,String messageTo,String subject,String messageBody) throws Exception
properties.put("mail.from",messageFrom);
InternetAddress[] address={ new InternetAddress(messageTo) };
message.setFrom(new InternetAddress(messageFrom));
message.setRecipients(Message.RecipientType.TO,address);
message.setSubject(subject);
message.setContent(messageBody,"text/plain");
Transport transport=session.getTransport(address[0]);
transport.addConnectionListener(new ConnectionHandler());
transport.addTransportListener(new TransportHandler());
transport.connect();
transport.sendMessage(message,address);
} //*************************************************************************end function
} //*************************************************************************************end main
class ConnectionHandler extends ConnectionAdapter
public void opened(ConnectionEvent e)
System.out.println("connection opened");
public void disconnected(ConnectionEvent e)
System.out.println("connection disconnected");
public void closed(ConnectionEvent e)
System.out.println("connection closed");
} //*************************************************************************************end main
class TransportHandler extends TransportAdapter
public void messageDelivered(TransportAdapter e)
System.out.println("message delivered");
public void messageNotDelivered(TransportAdapter e)
System.out.println("message NOT delivered");
public void messagePartiallyDelivered(TransportAdapter e)
System.out.println("message partially delivered");
} //*************************************************************************************end main
class ServerAuthenticate extends Authenticator
String smtpUsername = null;
String smtpPassword = null;
public ServerAuthenticate(String username, String password)
smtpUsername = username;
smtpPassword = password;
protected PasswordAuthentication getPasswordAuthentication()
return new PasswordAuthentication(smtpUsername,smtpPassword);
public static void main(String str[])throws Exception
JavaMailUserAgent jmail=new
JavaMailUserAgent("smtp.mail.yahoo.com","[email protected]","passwordd");
jmail.sendMail("[email protected]","[email protected]","test subject","test message");
ERROR:
E:\mail\javamail\servlet>java ServerAuthenticate
connection opened
Exception in thread "main" javax.mail.MessagingException: 530 authentication req
uired - for help go to http://help.yahoo.com/help/us/mail/pop/pop-11.html
at com.sun.mail.smtp.SMTPTransport.issueCommand(SMTPTransport.java:879)
at com.sun.mail.smtp.SMTPTransport.mailFrom(SMTPTransport.java:599)
at com.sun.mail.smtp.SMTPTransport.sendMessage(Compiled Code)
at JavaMailUserAgent.sendMail(JavaMailUserAgent.java:58)
at ServerAuthenticate.main(JavaMailUserAgent.java:131)
How Could I rectyfy the above error ?????
Regards,
Mahesh. -
How to build a mail server in java?
greetings all i have an app(spring+hibernate) that needs to send thousands of emails simultaneously and i was told that the best solution here is to have a mail server i don't have any idea where to start or if there's a framework or a service that is better so please guys give me some info where to start, thank you.
[http://java.sun.com/products/javamail/FAQ.html#servers|http://java.sun.com/products/javamail/FAQ.html#servers]
Maybe you are looking for
-
when running programs like sketchup, I right click on logo in the dock. I choose a recently opened file, but it does not open. Anybody know why? How to remedy this?
-
Google map sometimes not appearing
When I moved to the desktop that is assigned to iPhoto, (and it is already launched and open there as usual in my setup) and select a photo, (including one that has a pin in the Google map) the Google map states in an big text overlay that I am not c
-
PR to PO via ME59 -Doc type issue
Hi , I am executing the functionality of auto PO and did all the master data settings. When I convert PR of doc type NB to PO via ME59, then it takes PO doc type as NB. Similarly, when I convert PR of doc type ZNB to PO via ME59, then it takes PO doc
-
Control Inspection Lot option-QM view
Hi all, We want the system to create only one inspection lot for partial goods reciept from a production order.As an option i have selected "for each material,batch and storage locaion"option in QM view.Material is batch managed and serial
-
I am an academic using Papers ref manager. Love Pages, but cannot cite from Papers3 in Pages. V frustrating. Any solutions?