| City Hunter さんのプロフィールsenses-感觉ブログリスト | ヘルプ |
|
|
8月9日 Mail 我讨厌邮件!!!!`^`没有用过javamail,刚刚起步,开始学习弄一个网络邮件系统,这个郁闷阿。这个什么破静态函数还不好使,我&$%$$#^#……(省略1W字)。测试例子:
try
{...
Properties p = new Properties();
Transport trans; Session sendMailSession;
sendMailSession = Session.getDefaultInstance(p,null);
FileInputStream is = new FileInputStream("F:/test.eml"); Message newMessage = new MimeMessage(sendMailSession,is); Message replyM = (MimeMessage)newMessage.reply(false); trans = sendMailSession.getTransport("smtp");
trans.connect(smtphost,username,userpass); Transport.send(replyM,replyM.getRecipients(Message.RecipientType.TO)); trans.close();... }
catch(Exception e)
{....}
居然不能发送回复,暴走中……
不用授权类Authenticator给Session也能成功的发送和接收邮件,那么什么时候要用呢,费解……
我就纳闷了……同样都是写程序的程序员,做出来的程序的差距咋就那么大呢。 最郁闷的是别人为你精心安排了一切,提供了所有的工具,而你却一点也不清楚,不知道如何去使用。
他们咋就不能用中文写个文档呢? |
|
|