My Java Learning Road 2: Email Send

xiaoxiao2021-03-06  79

<% @ page import = "Sun.net.smtp.smtpclient, java.io. *"%>

<%

String from = "** @ **. COM";

String to =

**@**.com;

Try {

SMTPCLIENT Client = New SMTPCLIENT ("Mail. **. **");

Client.from (from);

Client.to (to);

PRINTSTREAM Message = Client.StartMessage ();

Message.println ("TO:" to);

Message.println ("Subject: Sending Email from JSP!");

Message.println ("This Was Sent From A JSP Page!");

Message.println ();

Message.println ("COOL! :-)");

Message.println ();

Message.println ("Good Boy");

Message.println ("I'm in genius.com");

Message.println ();

Client.closserver ();

}

Catch (IOException E) {

System.out.println ("Error Sending Email: E);

}

%>

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

New Post(0)