zoukankan      html  css  js  c++  java
  • mail函数发送邮件

    调用的方法很简单:

    <?php
    
    $to = "myemail@163.com";
    $subject = "Test mail";
    $message = "Hello! This is a simple email message.";
    $headers = "From:dragon";
    mail($to,$subject,$message,$headers);
    echo "Mail Sent.";
    
    ?>

    收到的邮件:

    调用很简单吧!!!但是mail函数需要两个东西:

    1、php-ini文件

    上面需要设置的参数:

    sendmail_path = "E:\phpStudy\php\sendmail\sendmail.exe -t"

    2、sendmail文件夹;

    https://www.glob.com.au/sendmail/

    直接下载zip文件夹放在php同级目录或者其他目录,就可以了,然后配置文件夹里面的sendmail.ini

    在sendmail.ini文件夹之中需要配置的参数:

    //如果你用163,smtp.163.com
    smtp_server=smtp.qq.com
    //打开错误日志记录
    error_logfile=error.log
    //打开调试信息报告
    debug_logfile=debug.log
    //这个就是你的smtp账号密码,这里我用的是QQ
    auth_username=***1851@qq.com
    auth_password=leljxhdhbidi
    //这个是发送人,要跟auth_username一样
    force_sender=***1851@qq.com

    好啦,配置做好了,原来还是不能发送匿名邮件啊

  • 相关阅读:
    一、异常
    自控力_第三章
    Vocabulary Recitation 2020/05/05
    Vocabulary Recitation 2020/05/04
    Vocabulary Recitaion 2020/05/03
    Vocabulary Recitation 2020/05/01
    最大子序列和
    Vocabulary Recitation 2020/04/29
    自控力_第二章
    Vocabulary Recitation 2020/04/27
  • 原文地址:https://www.cnblogs.com/xuweiqiang/p/7197957.html
Copyright © 2011-2022 走看看