You can also use GMAIL smtp to send mail Here is a sample snippet String host = "smtp.gmail. Com"; String from = "username"; String pass = "password"; Properties props = System.getProperties(); props. Put("mail.smtp.starttls.
Enable", "true"); // added this line props. Put("mail.smtp. Host", host); props.
Put("mail.smtp. User", from); props. Put("mail.smtp.
Password", pass); props. Put("mail.smtp. Port", "587"); props.
Put("mail.smtp. Auth", "true"); String to = {"to@gmail. Com"}; // added this line Session session = Session.
GetDefaultInstance(props, null); MimeMessage message = new MimeMessage(session); message. SetFrom(new InternetAddress(from)); InternetAddress toAddress = new InternetAddressto. Length; // To get the array of addresses for( int i=0; I Length; i++ ) { // changed from a while loop toAddressi = new InternetAddress(toi); } System.out.
Println(Message.RecipientType. TO); for( int i=0; I Length; i++) { // changed from a while loop message. AddRecipient(Message.RecipientType.
TO, toAddressi); } message. SetSubject("sending in a group"); message. SetText("Welcome to JavaMail"); Transport transport = session.
GetTransport("smtp"); transport. Connect(host, from, pass); transport. SendMessage(message, message.
GetAllRecipients()); transport.close().
You can also use GMAIL smtp to send mail. Here is a sample snippet String host = "smtp.gmail. Com"; String from = "username"; String pass = "password"; Properties props = System.getProperties(); props.
Put("mail.smtp.starttls. Enable", "true"); // added this line props. Put("mail.smtp.
Host", host); props. Put("mail.smtp. User", from); props.
Put("mail.smtp. Password", pass); props. Put("mail.smtp.
Port", "587"); props. Put("mail.smtp. Auth", "true"); String to = {"[email protected]"}; // added this line Session session = Session.
GetDefaultInstance(props, null); MimeMessage message = new MimeMessage(session); message. SetFrom(new InternetAddress(from)); InternetAddress toAddress = new InternetAddressto. Length; // To get the array of addresses for( int i=0; I TO); for( int i=0; I TO, toAddressi); } message.
SetSubject("sending in a group"); message. SetText("Welcome to JavaMail"); Transport transport = session. GetTransport("smtp"); transport.
Connect(host, from, pass); transport. SendMessage(message, message. GetAllRecipients()); transport.close().
Any dependencies on google. Can I send mail to any email address. – sushil bharwani Oct 27 '10 at 16:30 @sushil bharwani, yes you can send it to any valid mail address, google's server will get use.
That s the only dependency – Jigar Joshi Oct 27 '10 at 16:31 can use I use google smtp server for production level code. Like I use it for sending mails by 20,000 employees. Sorry if I sound stupid.
– sushil bharwani Oct 27 '10 at 16:36 @sushil bharwani , If you planning to send mail to client or user it won't look good if you will use gmail :) , you can have gmail for enterprise also it will give you @yourdomainname. Com ,at last it is your choice – Jigar Joshi Oct 27 '10 at 16:39 I didn't followed "It won't look good" lets say I am developing application for my company. The mails are send to companies clients and employees.
What are the reasons I should not use GMAIL SMTP. – sushil bharwani Oct 27 '10 at 16:55.
I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.