java 163 mailbox to send mail

tags:  java mailbox

java 163 send mail

  • Code
  • The jar package to be referenced
  • Open your mailbox to set the authorization code

Code

public class SendMessageUtils {

    // sender account and password
    public static final String MY_EMAIL_ACCOUNT = "Your email  [email protected]";
    public static final String MY_EMAIL_PASSWORD = "The authorization code you set (not your email password)";

    // SMTP server (163 SMTP server used here)
    public static final String MEAIL_163_SMTP_HOST = "smtp.163.com";
    public static final String SMTP_163_PORT = "25";// Port number, this is used by 163; QQ should be 465 or 875

    // recipient
    public static final String RECEIVE_EMAIL_ACCOUNT = "***@**.com";// The email you want to send

    public static void main(String[] args) throws AddressException, MessagingException {
        Properties p = new Properties();
        p.setProperty("mail.smtp.host", MEAIL_163_SMTP_HOST);
        p.setProperty("mail.smtp.port", SMTP_163_PORT);
        p.setProperty("mail.smtp.socketFactory.port", SMTP_163_PORT);
        p.setProperty("mail.smtp.auth", "true");
        p.setProperty("mail.smtp.socketFactory.class", "SSL_FACTORY");

        Session session = Session.getInstance(p, new Authenticator() {
            // Set authentication account information
            @Override
            protected PasswordAuthentication getPasswordAuthentication() {
                return new PasswordAuthentication(MY_EMAIL_ACCOUNT, MY_EMAIL_PASSWORD);
            }
        });
        session.setDebug(true);
        System.out.println("Create Message");
        MimeMessage message = new MimeMessage(session);
        // From
        message.setFrom(new InternetAddress(MY_EMAIL_ACCOUNT));
        // recipient and cc
        message.setRecipients(Message.RecipientType.TO, RECEIVE_EMAIL_ACCOUNT);
//		message.setRecipients(Message.RecipientType.CC, MY_EMAIL_ACCOUNT);

        // Content (This content cannot be written yet, it may be rejected by SMTP; try it a few times)
        message.setSubject("file");
        message.setContent("<h1> Beautiful Mushroom Cool </ h1>", "text/html;charset=UTF-8");
        message.setSentDate(new Date());
        message.saveChanges();
        System.out.println("Ready to send");
        Transport.send(message);
    }
}

The jar package to be referenced

    <dependency >
        <groupId >com.sun.mail </groupId >
        <artifactId >javax.mail </artifactId >
        <version >1.5.4 </version >
    </dependency >

Open your mailbox to set the authorization code

Copyright Complaint       Spam Report

Intelligent Recommendation

python send mail (163 mailbox)

 ...

java-send 163 mailbox

1. The required jar package javaMail; can be downloaded from GIT, I used 1.6 here     https://github.com/javaee/javamail/releases 2. Open the 163 grantWeight code, enter the follow...

Matlab send mail qq mailbox/163 mailbox

Sometimes when we run a large program, it usually takes several hours. At this time, it is very convenient to use matlab to send an email to notify the program in time. Here we will mainly use 163 mai...

Java implements Netease Enterprise 163 Mailbox Send Mail

premise: This article introduces two emails, one isNetease 163 mailbox,the other isNetease Enterprise 163 Mailbox project address:https://github.com/su1573/mail-send First, log in to the mailbox setti...

Java: Send 163 Mail

The code can be run directly, and the 163 mailbox needs to apply for the client authorization code. Sending a QQ mailbox to other mailboxes may be treated as spam, you can add white list domain name (...

More Recommendation

Implement 163 mailbox to send mail function

Ready to work: There is a 163 email account first: Do some mail sending settings Check the relevant service settings and set the client authorization password, which is required to be entered in the c...

Gitlab uses 163 mailbox to send mail to users

First, configure SMTP, so that GitLab sends mail to users through 163 mailboxes. The specific configuration information is as follows: Description: external_url 'http://XXXXX.com' : It is the address ...

Call API to send mail 163 mailbox Python

163 mailbox needs to open STMP service in the settings...

Python calls 163 mailbox to send mail

Python has built-in support for SMTP and can send plain text emails, HTML emails and emails with attachments. Python supports SMTP with two modules, smtplib and email. Email is responsible for constru...

QT5 uses 163 mailbox to send mail

Recently I'm using QT to write something and want to send an email. Checked some information and found that there is no official library, many seniors are recommended to usesendemailapiBut thiswebsite...

Copyright   DMCA © 2018-2024 - All Rights Reserved - www.programmersought.com   User Notice

Top

哆哆女性网公司起名新字名字大全新三国电视剧免费看鼠年胡姓女宝宝起名吉林省农村信用社周公解梦自己哭了精灵宝贝梦游戏破解版手机表白网站制作网站保罗乔治受伤道家养生大道宝宝姓贺取名起名大全希字起名7画起名吉利字有哪些八字缺土取名起名大全大全机械免费网站制作门户网站网站制作起名袁姓女北流的美食用业起名周易 免费取名字国家安全教育读后感起名工艺品公司五行八字起什么名字好冈仁波齐电影观后感周易起名字网公司名称政府网站建设价格龙岩市网站建设公司邵华简介姓贺的女宝宝起名大全集谜的作文六年级火锅店起什么名字淀粉肠小王子日销售额涨超10倍罗斯否认插足凯特王妃婚姻不负春光新的一天从800个哈欠开始有个姐真把千机伞做出来了国产伟哥去年销售近13亿充个话费竟沦为间接洗钱工具重庆警方辟谣“男子杀人焚尸”男子给前妻转账 现任妻子起诉要回春分繁花正当时呼北高速交通事故已致14人死亡杨洋拄拐现身医院月嫂回应掌掴婴儿是在赶虫子男孩疑遭霸凌 家长讨说法被踢出群因自嘲式简历走红的教授更新简介网友建议重庆地铁不准乘客携带菜筐清明节放假3天调休1天郑州一火锅店爆改成麻辣烫店19岁小伙救下5人后溺亡 多方发声两大学生合买彩票中奖一人不认账张家界的山上“长”满了韩国人?单亲妈妈陷入热恋 14岁儿子报警#春分立蛋大挑战#青海通报栏杆断裂小学生跌落住进ICU代拍被何赛飞拿着魔杖追着打315晚会后胖东来又人满为患了当地回应沈阳致3死车祸车主疑毒驾武汉大学樱花即将进入盛花期张立群任西安交通大学校长为江西彩礼“减负”的“试婚人”网友洛杉矶偶遇贾玲倪萍分享减重40斤方法男孩8年未见母亲被告知被遗忘小米汽车超级工厂正式揭幕周杰伦一审败诉网易特朗普谈“凯特王妃P图照”考生莫言也上北大硕士复试名单了妈妈回应孩子在校撞护栏坠楼恒大被罚41.75亿到底怎么缴男子持台球杆殴打2名女店员被抓校方回应护栏损坏小学生课间坠楼外国人感慨凌晨的中国很安全火箭最近9战8胜1负王树国3次鞠躬告别西交大师生房客欠租失踪 房东直发愁萧美琴窜访捷克 外交部回应山西省委原副书记商黎光被逮捕阿根廷将发行1万与2万面值的纸币英国王室又一合照被质疑P图男子被猫抓伤后确诊“猫抓病”

哆哆女性网 XML地图 TXT地图 虚拟主机 SEO 网站制作 网站优化