阿里云ECS发送企业邮件
2024-10-02 04:32:42
<?php
use PHPMailer\PHPMailer\PHPMailer;
require '../vendor/autoload.php'; $mail = new PHPMailer(true); try {
//Server settings
$mail->CharSet = 'utf-8';
$mail->SMTPDebug = 2;
$mail->isSMTP();
$mail->Host = 'ssl://smtp.mxhichina.com'; //使用阿里云注意使用ssl协议
$mail->SMTPAuth = true;
$mail->Username = 'xxx';
$mail->Password = 'xxx';
$mail->SMTPSecure = 'tls';
$mail->Port = 465; //阿里云开启端口 //Recipients
$mail->setFrom('xxx', 'xxxxxx');
$mail->addAddress('xxx', 'Joe User');
$mail->addAddress('xxx', 'Joe User');
$mail->addReplyTo('xxx', 'Information'); $mail->isHTML(true);
$mail->Subject = '阿里企业邮箱发送自动发送邮件';
$mail->Body = '<b>报警了....</b>';
$mail->AltBody = '报警邮件'; $mail->send();
echo 'Message has been sent';
} catch (Exception $e) {
echo 'Message could not be sent. Mailer Error: ', $mail->ErrorInfo;
}
最新文章
- ubuntu下使用visual studio code来编译和调试C++
- 在Py文件中引入django环境
- Android--Retrofit的简单使用(一)
- openstack排错
- Winsock完成端口模型-Delphi代码
- web版扫雷小游戏(四)
- 在CheckBox中,仅仅允许选择一项
- Mojo 分析日志接口
- Java中IO流
- 游戏音频技术备忘 (三) 集成Wwise到Unreal Engine
- 09 ListView监听 ExpandableListView的使用总结
- SQL Server 中如何做到连续时间段的拆分?
- UVA 10618 Tango Tango Insurrection
- ubuntu 下redis的安装简介
- maven 配置文件settings.xml设置
- [leetcode]28. Implement strStr()实现strStr()
- boost asio 学习(一)io_service的基础
- 【12月26日】A股滚动市盈率PE最低排名
- Ubuntu系统查看mongo得慢日志,及一些操作
- 给tabBarItem加点击效果动画
热门文章
- code first迁移(add-migration)的时候 后面信息不能有中文 中文报错 ";不支持给定路径的格式。";
- Android开发 ----------怎样真机调试?
- qt的应用层主要是大型3d,vr,管理软件和器械嵌入软件(有上千个下一代软件黑科技项目是qt的,美国宇航局,欧洲宇航局,超级战舰DDG1000)
- 实用的 Matlab
- WPF:将Office文档、任意类型文件嵌入到EXE可执行文件中
- .net元数据
- [bug系列]Method not found: &#39;Void Microsoft.EntityFrameworkCore.Storage.Internal.RelationalCommandBuilderFactory
- JS 中按键处理
- c#定时调用作业
- Z-Order