婷婷综合国产,91蜜桃婷婷狠狠久久综合9色 ,九九九九九精品,国产综合av

主頁 > 知識庫 > 郵件發送簡單例子-bean文件

郵件發送簡單例子-bean文件

熱門標簽:廣州三五防封電銷卡 珠海銷售外呼系統運營商 四川電信外呼系統靠譜嗎 外呼系統啥意思 電銷外呼系統 排行榜 長春回撥外呼系統廠家 地圖標注制作道路 山東智能云外呼管理系統 地圖標注創業項目入駐
SimpleSendMessage.java

import java.util.*;

import javax.mail.*;
import javax.mail.internet.*;
import javax.activation.*;

public class SimpleSendMessage {

public static void main(String[] args) {

// Collect the necessary information to send a simple message
// Make sure to replace the values for host, to, and from with
// valid information.
// host - must be a valid smtp server that you currently have
// access to.
// to - whoever is going to get your email
// from - whoever you want to be. Just remember that many smtp
// servers will validate the domain of the from address
// before allowing the mail to be sent.
String host = "server.myhost.com";
String to = "YourFriend@somewhere.com";
String from = "MeMeMe@myhost.com";
String subject = "JSP Rules!";
String messageText = "I am sending a message using the"
+ " JavaMail API.\nI can include any text that I want.";
boolean sessionDebug = false;

// Create some properties and get the default Session.
Properties props = System.getProperties();
props.put("mail.host", host);
props.put("mail.transport.protocol", "smtp");

Session session = Session.getDefaultInstance(props, null);

// Set debug on the Session so we can see what is going on
// Passing false will not echo debug info, and passing true
// will.
session.setDebug(sessionDebug);

try {

// Instantiate a new MimeMessage and fill it with the
// required information.
Message msg = new MimeMessage(session);

msg.setFrom(new InternetAddress(from));
InternetAddress[] address = {new InternetAddress(to)};
msg.setRecipients(Message.RecipientType.TO, address);
msg.setSubject(subject);
msg.setSentDate(new Date());
msg.setText(messageText);

// Hand the message to the default transport service
// for delivery.
Transport.send(msg);
}
catch (MessagingException mex) {

mex.printStackTrace();
}
}
}

標簽:肇慶 保定 廣元 紹興 北海 玉樹 吳忠 潮州

巨人網絡通訊聲明:本文標題《郵件發送簡單例子-bean文件》,本文關鍵詞  郵件,發送,簡單,例子,-bean,;如發現本文內容存在版權問題,煩請提供相關信息告之我們,我們將及時溝通與處理。本站內容系統采集于網絡,涉及言論、版權與本站無關。
  • 相關文章
  • 下面列出與本文章《郵件發送簡單例子-bean文件》相關的同類信息!
  • 本頁收集關于郵件發送簡單例子-bean文件的相關信息資訊供網民參考!
  • 推薦文章
    主站蜘蛛池模板: 商河县| 封开县| 安义县| 澜沧| 寿宁县| 资阳市| 深州市| 长治市| 平度市| 黎城县| 卢湾区| 小金县| 阿克| 泰州市| 丹寨县| 安顺市| 新化县| 浦县| 平利县| 阿克| 堆龙德庆县| 绥阳县| 湟源县| 都江堰市| 浏阳市| 东安县| 西乌| 聂拉木县| 旅游| 宜川县| 林西县| 北京市| 当雄县| 襄汾县| 胶州市| 竹北市| 徐州市| 武汉市| 永和县| 鄂伦春自治旗| 保定市|