引用 | 编辑
louisz
2005-03-02 18:29 |
楼主
▼ |
||
x0
这是一个简易的使用Javamail API来寄信的程式,在使用时需要先设定一些资料,因为是使用Javamail的API,所以要将mail.jar以及activation.jar加入到classpath中﹝有IDE者就挂上去吧﹞,我在程式中有写注解大家可以参考的看喔,当然最好的就是看一下JavaMail api的文件档案太大不能上传,就请大家自己去下载 Javamail api下载的位置(mail.jar) JavaBeans Activation Framework 下载位置(activation.jar) import java.util.Date; import javax.mail.Message; import javax.mail.Multipart; import javax.mail.Transport; import javax.mail.internet.InternetAddress; import javax.mail.internet.MimeBodyPart; import javax.mail.internet.MimeMessage; import javax.mail.internet.MimeMultipart; /* * Created on 2005/3/2 * * TODO To change the template for this generated file go to * Window - Preferences - Java - Code Style - Code Templates */ /** * @author louisz * * TODO To change the template for this generated type comment go to * Window - Preferences - Java - Code Style - Code Templates */ public class MailSend { private boolean authFlag=false; /* *sender-->寄件者是谁寄的 *receiver-->收件者也就是要寄到哪里去 *smtpHost-->smtp server的hostname或IP ex:pchome.com.tw *username-->帐号使用者名称 *password-->帐号使用者密码 *subject-->主旨 */ public boolean sendMail(String sender,String receiver,String smtpHost,String use .. 访客只能看到部份内容,免费 加入会员 x0
|