Simple email sender!

zhaozj2021-02-16  61

Import java.util. *; import java.io. *; import javax.mail. *; import javax.mail.internet. *; import javax.activation. *;

/ ** *

Title: *

Description: *

Copyright: Copyright (c) 2004 *

Company: Softek System * @Author Softek System Development Team * @version 1.0 * /

Public class sendmail {

Public static void main (string [] args) {boolean is = new sendmail (). Sendmail ("Sender Address", "Recipient Address", "Title", "Letter Content"); IF (IS) SYSTEM .out.print ("ok!"); else system.out.print ("Error!");

}

private String smtpHost = "smtp.163.com"; public boolean sendMail (String fromAddress, String toAddress, String subject, String msgText) {boolean isOk = false; smtpHost = "smtp.163.com"; Properties props = new Properties ( ); Props.put ("mail.smtp.host", smtphost); automin auth = new automin ();

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

New Post(0)