smtp

linux下phpmailer发送邮件出现SMTP ERROR: Failed to connect to server: (0)错误

匿名 (未验证) 提交于 2019-12-02 22:11:45
在做项目的过程中,后期客户提出了发送邮件的需求,既然客户有需求,那么没啥说的,上呗。 经过网上的一般资料查找,PHPMailer这个插件貌似用起来不错,那就从github clone一份来,下载链接是 PHPMailer。 官当demo如下:当然相关的配置要换成你自己的 //Create a new PHPMailer instance $mail = new PHPMailer ; //Tell PHPMailer to use SMTP $mail -> isSMTP (); //Enable SMTP debugging // 0 = off (for production use) // 1 = client messages // 2 = client and server messages $mail -> SMTPDebug = 2 ; //Set the hostname of the mail server $mail -> Host = 'smtp.qq.com' ; //$mail->Host = 'smtp.163.com'; //Set the SMTP port number - likely to be 25, 465 or 587 $mail -> Port = 465 ; $mail -> SMTPSecure = "ssl" ; //$mail-

解决升级PHP7.1后,发邮件时提示“fsockopen(): Peer certificate CN=`xxx.xx.com' did not match expected CN=`113.x.xx.98”

匿名 (未验证) 提交于 2019-12-02 22:11:45
把项目环境升级到PHP7.1后,发现在不使用SSL时可以使用IP发邮件,可设置成SSL时就只能使用hostname发送,PHP提示的错误信息大致意思是说,IP与hostname无法通过SSL验证,修改ci框架中Email类第2061行,结果又可以正常发邮件了,故作此记录。 // 修改的代码 $ctx = stream_context_create ( array ( 'ssl' => array ( 'verify_peer_name' => FALSE , ) )); $this -> _smtp_connect = stream_socket_client ( $ssl . $this -> smtp_host . ':' . $this -> smtp_port , $errno , $errstr , $this -> smtp_timeout , STREAM_CLIENT_CONNECT , $ctx ); // 注释原来的代码 // $this->_smtp_connect = @fsockopen($ssl.$this->smtp_host, // $this->smtp_port, // $errno, // $errstr, // $this->smtp_timeout); !!!根据官网及多数网站建议使用hostname代替IP!!! 转载请标明出处:

PHP+MySQL用户注册发送邮件激活账号实例

匿名 (未验证) 提交于 2019-12-02 22:11:45
PHP+MySQL用户注册发送邮件激活账号实例,样式用的layui,简洁美观。 1.注册发送邮件激活账号,同时检测邮箱是否已注册。 2.检测邮箱是否存在,当邮箱存在时判断是否激活,若未激活,则更改激活码和注册时间。邮箱不存在时则发送激活邮件。 邮件配置及注释 1 $smtpserver = "smtp.exmail.qq.com"; //SMTP服务器 2 $smtpserverport = 25; //SMTP服务器端口 3 $smtpusermail = "ruxi@faofao.cn"; //SMTP服务器的用户邮箱 4 $smtpuser = "ruxi@faofao.cn"; //SMTP服务器的用户帐号 5 $smtppass = "*********"; //SMTP服务器的授权码 6 $smtp = new Smtp($smtpserver, $smtpserverport, true, $smtpuser, $smtppass); //实例化邮件类 7 $emailtype = "HTML"; //信件类型,文本:text;网页:HTML 8 $smtpemailto = $email; 9 $smtpemailfrom = $smtpusermail; 10 $emailsubject = "用户帐号激活"; 11 $emailbody = " "; 12

常用SMTP地址

匿名 (未验证) 提交于 2019-12-02 22:06:11
1、QQ邮箱(mail.qq.com) POP3服务器地址:pop.qq.com(端口:110) SMTP服务器地址:smtp.qq.com(端口:25) 2、搜狐邮箱(sohu.com): POP3服务器地址:pop3.sohu.com(端口:110) SMTP服务器地址:smtp.sohu.com(端口:25) 3、HotMail邮箱(hotmail.com): POP3服务器地址:pop.live.com(端口:995) SMTP服务器地址:smtp.live.com(端口:587) 4、移动139邮箱: POP3服务器地址:POP.139.com(端口:110) SMTP服务器地址:SMTP.139.com(端口:25) 5、景安网络邮箱: POP3服务器地址:POP.zzidc.com(端口:110) SMTP服务器地址:SMTP.zzidc.com(端口:25) 文章来源: 常用SMTP地址

监控Linux的磁盘、内存、CPU

匿名 (未验证) 提交于 2019-12-02 21:56:30
1,安装 mailx [root@node-1 opt]# yum install mailx 2,编辑配置文件 [root@node-1 opt]# vim /etc/mail.rc #添加如下内容 set from=xxxx@163.com set smtp=smtp.163.com set smtp-auth-user=xx@163.com set smtp-auth-password=xxx set smtp-auth=login ---说明 建议用163邮箱 因为qq邮箱 smtp会有各种问题 from:对方收到邮件时显示的发件人 smtp:指定第三方发邮件的smtp服务器地址 set smtp-auth-user:第三方发邮件的用户名 set smtp-auth-password:用户名对应的密码,有些邮箱填的是授权码 smtp-auth:SMTP的认证方式,默认是login,也可以改成CRAM-MD5或PLAIN方式 3,编写 检测和运行脚本 monitor.sh #!/bin/bash #获取cpu使用率 cpuUsage=`top -n 1 | awk -F '[ %]+' 'NR==3 {print $2}'` #获取磁盘使用率 data_name="/dev/vda1" diskUsage=`df -h | grep $data_name | awk -F '

Centos7.5 部署postfix邮件系统

匿名 (未验证) 提交于 2019-12-02 21:53:52
1. Postfix 1.1 邮件服务的介绍 电子邮件是―种用电子手段提供信息交换的通信方式,是互联网应用最广的服务。通过网络的电子邮件系统,用户可以以非常低廉的价格(不管发送到哪里,都只需负担网费)、非常快速的方式(几秒钟之内可以发送到世界上任何指定的目的地),与世界上任何一个角落的网络用户联系。 电子邮件可以是文字、图像、声音等多种形式。同时,用户可以得到大量免费的新闻、专题邮件,并实现轻松的信息搜索。电子邮件的存在极大地方便了人与人之间的沟通与交流,促进了社会的发展。 什么是电子邮件系统 电子邮件系统是一种能够书写、发送、存储和接收信件的电子通信系统 邮件系统由两部分组成 MTA(邮件传输代理) MUA(邮件用户代理) 1.2 电子邮件收发的过程 1.3 邮件传输过程 (1)客户机调用用户代理来编辑要发送的邮件。用户代理用SMTP将邮件传送给发送端邮件服务器 (2)发送端邮件服务器将邮件放入邮件缓存队列中,等待发送。 (3)SMTP按照C/S方式工作。运行在发送端邮件服务器的SMTP客户进程,发现在邮件缓存中有待发送的邮件,就向运行在接收端邮件服务器的SMTP服务器进程发起TCP连接的建立 (4)当TCP连接建立后,SMTP客户进程开始向远程的SMTP服务器发送邮件。如果有多个邮件在邮件缓存中,则SMTP客户一一将它们发送到远程的SMTP服务器。当所有的待发送邮件发完了

JavaMailSender邮箱配置

匿名 (未验证) 提交于 2019-12-02 21:53:52
163邮箱: #####163邮箱######## spring.mail.host =smtp. 163 .com spring.mail.username =lon@ 163 .com #163邮箱密码 spring.mail.password = qS spring.mail.properties.mail.smtp.auth = true spring.mail.properties.mail.smtp.starttls.enable = true spring.mail.properties.mail.smtp.starttls.required = true gmail邮箱: spring.mail.host=smtp.gmail.com spring.mail.port=465 spring.mail.username=wwh@gmail.com spring.mail.password=ndb spring.mail.properties.mail.smtp.auth=true spring.mail.properties.mail.debug=true spring.mail.properties.mail.smtp.port=465 spring.mail.properties.mail.smtp.socketFactory.port=465 spring

Java - 谷歌邮箱发送邮件详解

匿名 (未验证) 提交于 2019-12-02 21:53:52
错误如下: at com.sun.mail.smtp.SMTPTransport$Authenticator.authenticate(SMTPTransport.java:826) at com.sun.mail.smtp.SMTPTransport.authenticate(SMTPTransport.java:761) at com.sun.mail.smtp.SMTPTransport.protocolConnect(SMTPTransport.java:685) at javax.mail.Service.connect(Service.java:317) at javax.mail.Service.connect(Service.java:176) at javax.mail.Service.connect(Service.java:125) at javax.mail.Transport.send0(Transport.java:194) at javax.mail.Transport.send(Transport.java:124) at com.ecnu.mail.JavaMailDemo.gmailSender(JavaMailDemo.java:60) at com.ecnu.mail.JavaMailDemo.main(JavaMailDemo.java

fgets() and fread() - What is the difference?

不问归期 提交于 2019-12-02 21:53:20
I understand the differences between fgets() and fgetss() but I don't get the difference between fgets() and fread() , can someone please clarify this subject? Which one is faster? Thanks! Pascal MARTIN fgets reads a line -- i.e. it will stop at a newline. fread reads raw data -- it will stop after a specified (or default) number of bytes, independently of any newline that might or might not be present. Speed is not a reason to use one over the other, as those two functions just don't do the same thing : If you want to read a line, from a text file, then use fgets If you want to read some data

JavaWeb 发送邮件

匿名 (未验证) 提交于 2019-12-02 21:52:03
我们可以使用第三方的邮箱服务器来发送邮件。 常用的邮件传输协议有2种:POP3/SMTP、IMAP/SMTP 。 POP和IMAP的区别:在邮箱客户端的操作,比如移动邮件、标记已读,如果使用POP,是不会同步到邮箱服务器上的;如果使用IMAP,这些操作会同步到邮箱服务器上。 示例 使用QQ邮箱服务器发送邮件 此处使用IMAP。可在 设置->账户 -> POP3/IMAP/SMTP/Exchange/CardDAV/CalDAV服务 中配置。 @WebServlet ( "/sendMailServlet" ) public class SendMailServlet extends HttpServlet { protected void doPost ( HttpServletRequest request , HttpServletResponse response ) throws ServletException , IOException { Properties properties = new Properties (); properties . put ( "mail.transport.protocol" , "smtp" ); // 连接协议 properties . put ( "mail.smtp.host" , "smtp.qq.com" ); //