zoukankan      html  css  js  c++  java
  • smtp 发送邮件类出错

    1、接收邮箱受限,部分企业内部邮箱不接收

    2、SMTP服务器信息填写错误。

    $smtpserver = "smtp.139.com";   

    3、SMTP服务器的用户邮箱和用户名错误(例如邮箱是yaradish@139.com,请分别试一下“yaradish”、“yaradish@139.com”,因为部分只需输入@前面的,有些邮箱要输入完整的)

    4、密码错误(注意的是要填写明文的密码)

    5、Transport发送对象的connect函数中的主机名不一致,即connect中的host("smtp.xxx.com")要跟发件人的host相同。

    其他注意事项:

    1、代码里面在做正则匹配时,注意添加模式修正符;网上很多版本里面没有 "/ /";

    2、在终端执行时,需要加上时间设置,否则报错

      PHP Warning:  date(): It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected the timezone 'UTC' for now, but please set date.timezone to select your timezone.

    date_default_timezone_set("America/Los_Angeles");

     3、在做测试的时候打开debug,查看返回的结果

    $Smtp->debug = true;

     以下是发送成功返回的信息

  • 相关阅读:
    6.11 修饰符的适用范围
    5.10 对象与垃圾回收
    5.9 枚举类
    5.8 java 11增强的Lambda表达式
    5.7 内部类
    5.6 接口
    5.5 抽象类
    5.4 final修饰符
    5.3 类成员
    5.2 Object类中两个需要被重写的方法
  • 原文地址:https://www.cnblogs.com/yaradish/p/10038046.html
Copyright © 2011-2022 走看看