/ Published in: Java
Expand |
Embed | Plain Text
import java.util.*; import javax.mail.*; import javax.mail.internet.*; public class JavaMail { String subject, throws MessagingException { props.put( "mail.smtp.host", "mySMTPHost" ); props.put( "mail.smtp.auth","true"); } }; Session session = Session.getDefaultInstance( props , authenticator); Message msg = new MimeMessage( session ); InternetAddress addressFrom = new InternetAddress( from ); msg.setFrom( addressFrom ); InternetAddress addressTo = new InternetAddress( recipient ); msg.setRecipient( Message.RecipientType.TO, addressTo ); msg.setSubject( subject ); msg.setContent( message, "text/plain" ); Transport.send( msg ); } { postMail( "[email protected]", "mySubject", "myContent", } }
You need to login to post a comment.
