Battle Java email

zhaozj2021-02-16  81

You must download Sun's JavaMail API package, address is: http://java.sun.com/products/javamail/ and add the associated package (JAR file) to ClassPath. Or if you install J2EE, add J2EE.jar to ClassPath. The source program is as follows, replacing the red portion. For you or if you have any questions, please let me discuss: petehero@126.com Import java.util. *; Import javax.mail. *; Import javax.mail.internet. *; / ** *

Title: Java Mail *

Description: *

Copyright: Copyright (c) 2004 *

company: * @Version 1.0 * / public class SendMail {public SendMail () {} public void send () {try {Properties props = new Properties (); Session sendMailSession; Store store; Transport transport; props.put ( "mail.smtp.auth", "true") "PrOPS.PUT (" mail.smtp.host "," smtp.yourmail.com "); // SMTP host name. Props.Put ("mail.smtp.user", "username@yourmail.com"); // senders email address. Props.Put ("mail.smtp.password", "888888"); // mail password. Popupauthenticator popa = new popupauthenticator (); // message security authentication.

转载请注明原文地址:https://www.9cbs.com/read-13861.html

New Post(0)