php用腾讯企业邮箱发送邮件,简易易懂,只需将配置信息修改成自己的即可使用,配置超简单,只要会基础的php语言,懂点逻辑都知道
2019-11-24 14:22:46 2KB php 腾讯企业邮箱 发送邮件
1
ThinkPHP31.3发送邮件,最简单的应用例子,主要看配置,配置自己的服务器邮箱(配置前设置服务器邮箱开通smtp服务)内含windows定时发送的方法。
2014-10-20 00:00:00 9.55MB ThinkPHP PHP 发送 邮件
1
package com.email.send; import java.util.Properties; import javax.activation.DataHandler; import javax.activation.FileDataSource; import javax.mail.Message; import javax.mail.Session; import javax.mail.Transport; import javax.mail.internet.InternetAddress; import javax.mail.internet.MimeBodyPart; import javax.mail.internet.MimeMessage; import javax.mail.internet.MimeMultipart; public class EmailSender { String protocol ="smtp"; //服务器 String from="*******@qq.com";//寄信人,这里可以改为你的邮箱地址 String to="*******@qq.com";//收信人,改为你要寄给那人的邮箱地址 建议可以用自己的QQ邮箱试试 String subject="Java发送邮件测试!";//邮件主题 String body="qq.com" + "";//邮件内容 这是一个HTTP网页类的邮件内容 public static void main(String []args)throws Exception{ String server ="smtp.qq.com";//QQ邮箱的服务器,例如新浪邮箱或者其他服务器可以自己去查,这里用QQ邮箱为例 String user="******@qq.com";//登录邮箱的用户,不如说你用QQ邮箱,那就写你登录QQ邮箱的帐号 String pass="*******";//登录密码 EmailSender sender=new EmailSender(); Session session= sender.createSession(); MimeMessage message=sender.createMessage(session); System.out.println("正在发送邮件..."); Transport transport=session.getTransport(); transport.connect(server,user,pass); transport.sendMessage(message,message.getRecipients(Message.RecipientType.TO)); transport.close(); System.out.println("发送成功!!!"); } public Session createSession(){ Properties props=new Properties(); props.setProperty("mail.transport.protocol", protocol); props.setProperty("mail.smtp.auth","true"); Session session=Session.getInstance(props); // session.setDebug(true); return session; } public MimeMessage createMessage(Session session)throws Exception{ MimeMessage message=new MimeMessage(session); message.setFrom(new InternetAddress(from)); message.setRecipients(Message.RecipientType.TO, InternetAddress.parse(to)); message.setSubject(subject); MimeMultipart multipart=new MimeMultipart("re
2011-03-29 00:00:00 1.21MB Java 发送邮件
1