<rt id="bn8ez"></rt>
<label id="bn8ez"></label>

  • <span id="bn8ez"></span>

    <label id="bn8ez"><meter id="bn8ez"></meter></label>

    waterye

    use jakarta-commons email

    requires jar: commons-email-1.0.jar, mail.jar, activation.jar

    1. send text mail
    SimpleEmail email = new SimpleEmail();
    email.setHostName(
    "211.154.104.29");
    email.setAuthentication(
    "water@itorgan.com", password);
    email.addTo(
    "waterye@gmail.com""Water Ye");
    email.setFrom(
    "water@itorgan.com""Water Ye");
    email.setSubject(
    "Test message");
    email.setMsg(
    "This is a simple test of commons-email");
    email.send();
    中文問題:
    // email.setMsg("測試郵件");
    email.setCharset("UTF-8");
    email.setContent(
    "測試郵件""text/plain;charset=GBK");
    SimpleEmail封得太過簡單, 看代碼就知道了.

    2. Sending email with attachments
    // Create the attachment
    EmailAttachment attachment = new EmailAttachment();
    attachment.setPath(
    "C:/mail/hello.groovy");
    attachment.setDisposition(EmailAttachment.ATTACHMENT);
    attachment.setDescription(
    "hello.groovy");
    attachment.setName(
    "hello.groovy");

    // Create the email message
    MultiPartEmail email = new MultiPartEmail();
    email.setHostName(
    "211.154.104.29");
    email.setAuthentication(
    "water@itorgan.com", password);
    email.addTo(
    "waterye@gmail.com""Water Ye");
    email.setFrom(
    "water@itorgan.com""Water Ye");
    email.setSubject(
    "hello groovy");
    email.setMsg(
    "groovy hello world");

    email.attach(attachment);   
    // add the attachment
    email.send();   // send the email

    3. send html email
    // Create the email message
    HtmlEmail email = new HtmlEmail();
    email.setHostName(
    "211.154.104.29");
    email.setAuthentication(
    "water@itorgan.com", password);
    email.addTo(
    "waterye@gmail.com""Water Ye");
    email.setFrom(
    "water@itorgan.com""Water Ye");
    email.setSubject(
    "Test email with inline image");

    // embed the image and get the content id
    URL url = new URL("http://www.itorgan.com/images/index/top1.gif");
    String cid 
    = email.embed(url, "Itorgan logo");

    email.setHtmlMsg(
    "<html>The itorgan logo - <img src=\"cid:" + cid + "\"></html>"); // set the html message

    email.setTextMsg(
    "Your email client does not support HTML messages"); // set the alternative message

    email.send();


    martin xus已寫過, 就不發布到首頁了

    posted on 2005-09-30 16:42 waterye 閱讀(574) 評論(0)  編輯  收藏 所屬分類: Java

    主站蜘蛛池模板: 亚洲一区爱区精品无码| 精品国产免费一区二区| 国产亚洲情侣一区二区无| 丁香六月婷婷精品免费观看 | 中文免费观看视频网站| 亚洲午夜精品久久久久久人妖 | 在线观看免费人成视频色| 亚洲一卡2卡4卡5卡6卡残暴在线| 国产精彩免费视频| 自拍日韩亚洲一区在线| 日韩av无码成人无码免费| 亚洲欧洲无码AV不卡在线| 国产片免费福利片永久| 色多多www视频在线观看免费| 亚洲人成影院在线观看| 在线观看免费无码专区| 亚洲成aⅴ人在线观看| 女人18毛片水真多免费看| 18禁亚洲深夜福利人口| 久久亚洲欧洲国产综合| 国产精品区免费视频| 亚洲一区二区三区高清不卡| 国产禁女女网站免费看| 九九热久久免费视频| 亚洲国产av一区二区三区丶| 国产男女猛烈无遮档免费视频网站| 日日狠狠久久偷偷色综合免费| 国产精一品亚洲二区在线播放 | 男男gay做爽爽的视频免费| 亚洲国产精品无码久久一线| 91免费播放人人爽人人快乐| 麻豆亚洲AV成人无码久久精品 | 亚洲综合精品香蕉久久网| 99精品视频免费在线观看| 亚洲综合一区国产精品| 久久久久亚洲精品天堂久久久久久| 95老司机免费福利| 直接进入免费看黄的网站| 亚洲一区综合在线播放| 四虎AV永久在线精品免费观看| 久久青青草原国产精品免费|