合规国际互联网加速 OSASE为企业客户提供高速稳定SD-WAN国际加速解决方案。 广告
``` smtp.*.com 465 wo*PHTDUHTMCQVUWGQL*hua2011@*.com LTAI5tK28QpAERYANJGkPMqt pRs19fqtXT3PY8GVGR57oQMdn6PWPU ``` # **下载** [PHPMailer/PHPMailer: The classic email sending library for PHP (github.com)](https://github.com/PHPMailer/PHPMailer) ``` composer require phpmailer/phpmailer ``` 如果您不使用composer,则 可以将[PHPMailer 下载](https://github.com/PHPMailer/PHPMailer/archive/master.zip)为 zip 文件(请注意,文档和示例不包含在 zip 文件中),然后将 PHPMailer 文件夹的内容复制到 PHP 配置中指定的目录之一,并手动加载每个类文件:`include_path` ~~~html <?php use PHPMailer\PHPMailer\PHPMailer; use PHPMailer\PHPMailer\Exception; require 'path/to/PHPMailer/src/Exception.php'; require 'path/to/PHPMailer/src/PHPMailer.php'; require 'path/to/PHPMailer/src/SMTP.php'; ~~~ 如果未显式使用该类(可能没有),则不需要 SMTP 类的行。即使不使用异常,您仍然需要加载Exception类,因为它在内部使用。`SMTP``use``Exception` # **示例** [PHPMailer/mailing\_list.phps at master · PHPMailer/PHPMailer · GitHub](https://github.com/PHPMailer/PHPMailer/blob/master/examples/mailing_list.phps) >[danger] 注意阿里云禁止了25端口,发送失败并返回`502 Bad Gateway`错误,所以我们需要ssl加密的465端口 首先需要下载PHPMailer类包: ``` <?php require('class.phpmailer.php'); $mail = new PHPMailer(); //实例化 $mail->IsSMTP(); // 启用SMTP $mail->Host = "smtp.163.com"; //SMTP服务器 163邮箱例子 //$mail->Host = "smtp.126.com"; //SMTP服务器 126邮箱例子 //$mail->Host = "smtp.qq.com"; //SMTP服务器 qq邮箱例子 $mail->Port = 25; //邮件发送端口 注意阿里云禁止了25端口需要465端口 $mail->SMTPAuth = true; //启用SMTP认证 $mail->CharSet = "UTF-8"; //字符集 $mail->Encoding = "base64"; //编码方式 $mail->Username = "abc@163.com"; //你的邮箱 $mail->Password = "xxx"; //你的密码 $mail->Subject = "xxx你好"; //邮件标题 $mail->From = "abc@163.com"; //发件人地址(也就是你的邮箱) $mail->FromName = "xxx"; //发件人姓名 $address = "xxx@qq.com";//收件人email $mail->AddAddress($address1, "xxx1"); //添加收件人1(地址,昵称) $mail->AddAddress($address2, "xxx2"); //添加收件人2(地址,昵称) $mail->AddAttachment('xx.xls','我的附件.xls'); // 添加附件,并指定名称 $mail->AddAttachment('xx1.xls','我的附件1.xls'); // 可以添加多个附件 $mail->AddAttachment('xx2.xls','我的附件2.xls'); // 可以添加多个附件 $mail->IsHTML(true); //支持html格式内容 $mail->AddEmbeddedImage("logo.jpg", "my-attach", "logo.jpg"); //设置邮件中的图片 $mail->Body = '你好, <b>朋友</b>! <br/>这是一封邮件!'; //邮件主体内容 //发送 if(!$mail->Send()) { echo "发送失败: " . $mail->ErrorInfo; } else { echo "成功"; } ?> ``` ![](https://img.kancloud.cn/66/59/665914babd2761f60336271d64b27be8_883x508.png) ``` <?php use PHPMailer\PHPMailer\PHPMailer; use PHPMailer\PHPMailer\Exception; require './src/Exception.php'; require './src/PHPMailer.php'; require './src/SMTP.php'; $mail = new PHPMailer(true); // Passing `true` enables exceptions try { //服务器配置 $mail->CharSet ="UTF-8"; //设定邮件编码 $mail->SMTPDebug = 0; // 调试模式输出 $mail->isSMTP(); // 使用SMTP $mail->Host = 'smtp.163.com'; // SMTP服务器 $mail->SMTPAuth = true; // 允许 SMTP 认证 $mail->Username = '邮箱用户名'; // SMTP 用户名 即邮箱的用户名 $mail->Password = '密码或者授权码'; // SMTP 密码 部分邮箱是授权码(例如163邮箱) $mail->SMTPSecure = 'ssl'; // 允许 TLS 或者ssl协议 $mail->Port = 465; // 服务器端口 25 或者465 具体要看邮箱服务器支持 $mail->setFrom('xxxx@163.com', 'Mailer'); //发件人 $mail->addAddress('aaaa@126.com', 'Joe'); // 收件人 //$mail->addAddress('ellen@example.com'); // 可添加多个收件人 $mail->addReplyTo('xxxx@163.com', 'info'); //回复的时候回复给哪个邮箱 建议和发件人一致 //$mail->addCC('cc@example.com'); //抄送 //$mail->addBCC('bcc@example.com'); //密送 //发送附件 // $mail->addAttachment('../xy.zip'); // 添加附件 // $mail->addAttachment('../thumb-1.jpg', 'new.jpg'); // 发送附件并且重命名 //Content $mail->isHTML(true); // 是否以HTML文档格式发送 发送后客户端可直接显示对应HTML内容 $mail->Subject = '这里是邮件标题' . time(); $mail->Body = '<h1>这里是邮件内容</h1>' . date('Y-m-d H:i:s'); $mail->AltBody = '如果邮件客户端不支持HTML则显示此内容'; $mail->send(); echo '邮件发送成功'; } catch (Exception $e) { echo '邮件发送失败: ', $mail->ErrorInfo; } ``` ![](https://img.kancloud.cn/9e/8b/9e8b3f8d1a970b006ff78788dbf95377_453x709.png) addStringAttachment与addAttachment的区别: 如果是资源二进制则用addStringAttachment,如果是已存在的文件的路径则用addAttachment发送 ~~~ $output = $dompdf->output(); $pdf_file=file_put_contents("myfile.pdf", $output); $mail->addAttachment($pdf_file, 'myfile.pdf'); $mail->addStringAttachment($dompdf->output(), 'my.pdf'); ~~~ ``` /** * 将文件发送到邮箱 */ public function emailpost(){ $file= "/xxx/ooo.jpg"; //后缀 $extension=pathinfo($file)['extension']; $sendTo=Request::post('from');//发送的邮箱地址 $filename=Request::post('name');//发送的文件名 $filename=$filename.".".$extension; if (file_exists($file)) { try { $mail = new \PHPMailer\PHPMailer\PHPMailer(); $arr = ['smtp_server'=>'stmp.163.com','smtp_port'=>25,...]; $config = convert_arr_kv($arr, 'name', 'value'); //检查是否邮箱格式 if (!is_email($sendTo)) { return json(['error' => 1, 'msg' => '邮箱格式有误']); } //所有项目必须填写 if (empty($config['smtp_server']) || empty($config['smtp_port']) || empty($config['smtp_user']) || empty($config['smtp_pwd'])) { return json(['error' => 1, 'msg' => '请完善邮件配置信息!']); } // 组装发送数据 $mail->CharSet = 'UTF-8'; //设定邮件编码,默认ISO-8859-1,如果发中文此项必须设置,否则乱码 $mail->isSMTP(); $mail->SMTPDebug = 0; //调试输出格式 //$mail->Debugoutput = 'html'; //smtp服务器 $mail->Host = $config['smtp_server']; //端口 - likely to be 25, 465 or 587 $mail->Port = $config['smtp_port']; //由于阿里云禁止了25端口,这里我们就需要换成465,同时兼容25端口和465端口 if ($mail->Port == '465') { $mail->SMTPSecure = 'ssl'; }// 使用安全协议 //Whether to use SMTP authentication $mail->SMTPAuth = true; //发送邮箱 $mail->Username = $config['smtp_user']; //密码 $mail->Password = $config['smtp_pwd']; //设置发送对象 (发送邮箱,发送人名称) $mail->setFrom($config['smtp_user'], $config['email_id']); //回复地址 // $mail->addReplyTo($config['smtp_user'], $config['email_id']); //接收邮件方 if (is_array($sendTo)) { foreach ($sendTo as $v) { $mail->addAddress($v); } } else { //addAddress(地址,昵称)群发可多次调用 $mail->addAddress($sendTo); } //$mail->AddAttachment('xx.xls','我的附件.xls'); // 添加附件,并指定名称 if (!$mail->AddAttachment($file, $filename)) { return json(['error' => 1, 'msg' => '附件发送失败!']); } $mail->isHTML(true);// send as HTML //标题 $mail->Subject = "文件下载"; $content="文件下载".$filename;//这里可以是html代码 //HTML内容转换 $mail->msgHTML($content); if (!$mail->send()) { $error_msg = 'Mailer Error: ' . $mail->ErrorInfo; return json(['error' => 1, 'msg' => $error_msg]); } return json(['error' => 0, 'msg' => $filename.'发送成功!']); } catch (\Exception $e) { $msginfo=$mail->ErrorInfo?:$e->getMessage(); $error_msg = 'Mailer Error: ' . $msginfo; return json(['error' => 1, 'msg' => $error_msg]); } }else{ return json(['error' => 1, 'msg' => '找不到该文件!']); } } } ``` # **邮箱配置** **网易邮箱配置如下图:** ![](https://img.kancloud.cn/ff/41/ff41617c053b652b4fdbe88d0b8bb9e3_488x141.png) **QQ 邮箱相关配置如下图:** | 邮箱 | POP3服务器(端口995) | SMTP服务器(端口465或587) | | --- | --- | --- | | qq.com | pop.qq.com | smtp.qq.com | ``` sina.com: POP3服务器地址:pop3.sina.com.cn(端口:110) SMTP服务器地址:smtp.sina.com.cn(端口:25) sinaVIP: POP3服务器:pop3.vip.sina.com (端口:110) SMTP服务器:smtp.vip.sina.com (端口:25) sohu.com: POP3服务器地址:pop3.sohu.com(端口:110) SMTP服务器地址:smtp.sohu.com(端口:25) 126邮箱: POP3服务器地址:pop.126.com(端口:110) SMTP服务器地址:smtp.126.com(端口:25) 139邮箱: POP3服务器地址:POP.139.com(端口:110) SMTP服务器地址:SMTP.139.com(端口:25) 163.com: POP3服务器地址:pop.163.com(端口:110) SMTP服务器地址:smtp.163.com(端口:25) QQ邮箱 POP3服务器地址:pop.qq.com(端口:110) SMTP服务器地址:smtp.qq.com (端口:25) QQ企业邮箱 POP3服务器地址:pop.exmail.qq.com (SSL启用 端口:995) SMTP服务器地址:smtp.exmail.qq.com(SSL启用 端口:587/465) yahoo.com: POP3服务器地址:pop.mail.yahoo.com SMTP服务器地址:smtp.mail.yahoo.com yahoo.com.cn: POP3服务器地址:pop.mail.yahoo.com.cn(端口:995) SMTP服务器地址:smtp.mail.yahoo.com.cn(端口:587 ``` 限制: 网易163邮箱一封邮件最多发送给  40  个收件人 , 每天发送限额为 50 封。 网易邮箱每天发邮箱限额数量详情: 1、企业邮箱 单个用户每天最多只能发送 1000 封邮件,单个邮件最多包含 500 个收件人邮箱地址。 2、163VIP邮箱 每天限制最多能发送800封邮件。 3、163 、 126 、 yeah 的邮箱   一封邮件最多发送给  40  个收件人 , 每天发送限额为 50 封。 其他不同邮箱每日发送邮箱限额说明: 1、盈世企业邮箱登录(原尚易企业邮箱) 一个邮箱账号一分钟最多发送400个邮件地址,一封邮件最多200个邮件地址,如果一封邮件包括200个收信人地址,一分钟最多不能超过 2 封邮件;如果一封邮件只有一个收信人地址 , 一分钟发送的邮件不能超过6封。       2、QQ邮箱 (1)2G的普通用户每天最大发信量是100封。 (2)3G会员、移动QQ 、QQ行及4G大肚邮用户每天最大发信量是500封。 (4)Foxmail免费邮箱每天发送量限制为50封 。 3、Gmail邮箱 邮件数量限制为每天 500 封,新申请的邮箱每天发送量限制50封 。 4、新浪邮箱 企业邮箱试用期用户每天限制80封,购买后发信没有限制。新浪免费邮箱,每天限制发送 30 封 。 5、雅虎免费邮箱 每小时发送量限制为100封,每天发送量限制为200封。 6、阿里巴巴英文站提高的企业邮箱 单个用户每天发送200封邮件 ,一天超过200封可能被系统自动冻结 。 ## **API** CHARSET_ASCII = 'us-ascii' CHARSET_ISO88591= 'iso-8859-1' CHARSET_UTF8 = 'utf-8' CONTENT_TYPE_MULTIPART_ALTERNATIVE = 'multipart/alternative' CONTENT_TYPE_MULTIPART_MIXED = 'multipart/mixed' CONTENT_TYPE_MULTIPART_RELATED = 'multipart/related' CONTENT_TYPE_PLAINTEXT = 'text/plain' CONTENT_TYPE_TEXT_CALENDAR = 'text/calendar' CONTENT_TYPE_TEXT_HTML = 'text/html' CRLF = "\r\n" SMTP标准CRLF换行 ENCODING_7BIT = '7bit' ENCODING_8BIT = '8bit' ENCODING_BASE64 = 'base64' ENCODING_BINARY = 'binary' ENCODING_QUOTED_PRINTABLE = 'quoted-printable' ENCRYPTION_SMTPS = 'ssl' ENCRYPTION_STARTTLS = 'tls' FWS = ' ' “折叠空白”是一种用于线折叠的空白字符串 ICAL_METHOD_ADD = 'ADD' ICAL_METHOD_CANCEL = 'CANCEL' ICAL_METHOD_COUNTER = 'COUNTER' ICAL_METHOD_DECLINECOUNTER = 'DECLINECOUNTER' ICAL_METHOD_PUBLISH = 'PUBLISH' ICAL_METHOD_REFRESH = 'REFRESH' ICAL_METHOD_REPLY = 'REPLY' ICAL_METHOD_REQUEST = 'REQUEST' MAIL_MAX_LINE_LENGTH = 63 mail()支持的最大行长度 MAX_LINE_LENGTH = 998 RFC 2822第2.1.1节允许的最大行长度 STD_LINE_LENGTH = 76 RFC 2822第2.1.1节允许的较低的最大行长度 STOP_CONTINUE = 1 错误严重程度: 消息,可能确定继续处理 STOP_CRITICAL = 2 错误严重程度: 消息,加上完全停止,达到严重错误 STOP_MESSAGE = 0 错误严重性: 仅消息,继续处理 VERSION = '6.8.0' phpmail版本号 ### 属性 $action_function : string >[info]回调函数名 $AllowEmpty : bool >[info]是否允许发送空消息体 $AltBody : string >[info]纯文本消息主体 $AuthType : string >[info]SMTP身份验证类型。选项有:CRAM-MD5、LOGIN、PLAIN、XOAUTH2。 $Body : string >[info]HTML或纯文本消息正文 $CharSet : string >[info]消息的字符集 $ConfirmReadingTo : string >[info]The email address that a reading confirmation should be sent to, also known as read receipt. $ContentType : string >[info]The MIME Content-type of the message. $Debugoutput : string|callable|LoggerInterface >[info]How to handle debug output. $DKIM_copyHeaderFields : bool >[info]DKIM Copy header field values for diagnostic use. $DKIM_domain : string >[info]DKIM signing domain name. $DKIM_extraHeaders : array<string|int, mixed> >[info]DKIM Extra signing headers. $DKIM_identity : string >[info]DKIM Identity. $DKIM_passphrase : string >[info]DKIM passphrase. $DKIM_private : string >[info]DKIM private key file path. $DKIM_private_string : string >[info]DKIM private key string. $DKIM_selector : string >[info]DKIM selector. $do_verp : bool >[info]Whether to generate VERP addresses on send. $dsn : mixed >[info]Comma separated list of DSN notifications 'NEVER' under no circumstances a DSN must be returned to the sender. $Encoding : string >[info]The message encoding. $ErrorInfo : string >[info]Holds the most recent mailer error message. $From : string >[info]The From email address for the message. $FromName : string >[info]The From name of the message. $Helo : string >[info]The SMTP HELO/EHLO name used for the SMTP connection. $Host : string >[info]SMTP hosts. $Hostname : string >[info]The hostname to use in the Message-ID header and as default HELO string. $Ical : string >[info]An iCal message part body. $Mailer : string >[info]Which method to use to send mail. $MessageDate : string >[info]The message Date to be used in the Date header. $MessageID : string >[info]An ID to be used in the Message-ID header. $Password : string >[info]SMTP password. $Port : int >[info]The default SMTP server port. $Priority : int|null >[info]Email priority. $Sender : string >[info]The envelope sender of the message. $Sendmail : string >[info]The path to the sendmail program. $SingleTo : bool >[info]Whether to split multiple to addresses into multiple messages or send them all in one message. $SMTPAuth : bool >[info]Whether to use SMTP authentication. $SMTPAutoTLS : bool >[info]Whether to enable TLS encryption automatically if a server supports it, even if `SMTPSecure` is not set to 'tls'. $SMTPDebug : int >[info]SMTP class debug output mode. $SMTPKeepAlive : bool >[info]Whether to keep the SMTP connection open after each message. $SMTPOptions : array<string|int, mixed> >[info]Options array passed to stream_context_create when connecting via SMTP. $SMTPSecure : string >[info]What kind of encryption to use on the SMTP connection. $Subject : string >[info]The Subject of the message. $Timeout : int >[info]The SMTP server timeout in seconds. $Username : string >[info]SMTP username. $UseSendmailOptions : bool >[info]Whether mail() uses a fully sendmail-compatible MTA. $validator : string|callable >[info]Which validator to use by default when validating email addresses. $WordWrap : int >[info]Word-wrap the message body to this number of chars. $XMailer : string|null >[info]What to put in the X-Mailer header. $all_recipients : array<string|int, mixed> >[info]An array of all kinds of addresses. $attachment : array<string|int, mixed> >[info]The array of attachments. $bcc : array<string|int, mixed> >[info]The array of 'bcc' names and addresses. $boundary : array<string|int, mixed> >[info]The array of MIME boundary strings. $cc : array<string|int, mixed> >[info]The array of 'cc' names and addresses. $CustomHeader : array<string|int, mixed> >[info]The array of custom headers. $error_count : int >[info]The number of errors encountered. $exceptions : bool >[info]Whether to throw exceptions for errors. $IcalMethods : array<string|int, string> >[info]Value-array of "method" in Contenttype header "text/calendar" $language : array<string|int, mixed> >[info]The array of available text strings for the current language. $lastMessageID : string >[info]The most recent Message-ID (including angular brackets). $LE : string >[info]SMTP RFC standard line ending; Carriage Return, Line Feed. $mailHeader : string >[info]Extra headers that createHeader() doesn't fold in. $message_type : string >[info]The message's MIME type. $MIMEBody : string >[info]The complete compiled MIME message body. $MIMEHeader : string >[info]The complete compiled MIME message headers. $oauth : OAuthTokenProvider >[info]An implementation of the PHPMailer OAuthTokenProvider interface. $RecipientsQueue : array<string|int, mixed> >[info]An array of names and addresses queued for validation. $ReplyTo : array<string|int, mixed> >[info]The array of reply-to names and addresses. $ReplyToQueue : array<string|int, mixed> >[info]An array of reply-to names and addresses queued for validation. $sign_cert_file : string >[info]The S/MIME certificate file path. $sign_extracerts_file : string >[info]The optional S/MIME extra certificates ("CA Chain") file path. $sign_key_file : string >[info]The S/MIME key file path. $sign_key_pass : string >[info]The S/MIME password for the key. $SingleToArray : array<string|int, mixed> >[info]Storage for addresses when SingleTo is enabled. $smtp : SMTP >[info]An instance of the SMTP sender class. $to : array<string|int, mixed> >[info]The array of 'to' names and addresses. $uniqueid : string >[info]Unique ID used for message ID and boundaries. ### 方法 __construct() : mixed >[info]Constructor. __destruct() : mixed >[info]Destructor. _mime_types() : string >[info]Get the MIME type for a file extension. addAddress() : bool >[info]Add a "To" address. addAttachment() : bool >[info]Add an attachment from a path on the filesystem. addBCC() : bool >[info]Add a "BCC" address. addCC() : bool >[info]Add a "CC" address. addCustomHeader() : bool >[info]Add a custom header. addEmbeddedImage() : bool >[info]Add an embedded (inline) attachment from a file. addrAppend() : string >[info]Create recipient headers. addReplyTo() : bool >[info]Add a "Reply-To" address. addrFormat() : string >[info]Format an address for use in a message header. addStringAttachment() : bool >[info]Add a string or binary attachment (non-filesystem). addStringEmbeddedImage() : bool >[info]Add an embedded stringified attachment. alternativeExists() : bool >[info]Check if this message has an alternative body set. attachmentExists() : bool >[info]Check if an attachment (non-inline) is present. base64EncodeWrapMB() : string >[info]Encode and wrap long multibyte strings for mail headers without breaking lines within a character. clearAddresses() : mixed >[info]Clear all To recipients. clearAllRecipients() : mixed >[info]Clear all recipient types. clearAttachments() : mixed >[info]Clear all filesystem, string, and binary attachments. clearBCCs() : mixed >[info]Clear all BCC recipients. clearCCs() : mixed >[info]Clear all CC recipients. clearCustomHeaders() : mixed >[info]Clear all custom headers. clearQueuedAddresses() : mixed >[info]Clear queued addresses of given kind. clearReplyTos() : mixed >[info]Clear all ReplyTo recipients. createBody() : string >[info]Assemble the message body. createHeader() : string >[info]Assemble message headers. DKIM_Add() : string >[info]Create the DKIM header and body in a new message header. DKIM_BodyC() : string >[info]Generate a DKIM canonicalization body. DKIM_HeaderC() : string >[info]Generate a DKIM canonicalization header. DKIM_QP() : string >[info]Quoted-Printable-encode a DKIM header. DKIM_Sign() : string >[info]Generate a DKIM signature. encodeHeader() : string >[info]Encode a header value (not including its label) optimally. encodeQ() : string >[info]Encode a string using Q encoding. encodeQP() : string >[info]Encode a string in quoted-printable format. encodeString() : string >[info]Encode a string in requested format. filenameToType() : string >[info]Map a file name to a MIME type. getAllRecipientAddresses() : array<string|int, mixed> >[info]Allows for public read access to 'all_recipients' property. getAttachments() : array<string|int, mixed> >[info]Return the array of attachments. getBccAddresses() : array<string|int, mixed> >[info]Allows for public read access to 'bcc' property. getBoundaries() : array<string|int, mixed> >[info]Get the boundaries that this message will use getCcAddresses() : array<string|int, mixed> >[info]Allows for public read access to 'cc' property. getCustomHeaders() : array<string|int, mixed> >[info]Returns all custom headers. getLastMessageID() : string >[info]Return the Message-ID header of the last email. getLE() : string >[info]Return the current line break format string. getMailMIME() : string >[info]Get the message MIME type headers. getOAuth() : OAuthTokenProvider >[info]Get the OAuthTokenProvider instance. getReplyToAddresses() : array<string|int, mixed> >[info]Allows for public read access to 'ReplyTo' property. getSentMIMEMessage() : string >[info]Returns the whole MIME message. getSMTPInstance() : SMTP >[info]Get an instance to use for SMTP operations. getToAddresses() : array<string|int, mixed> >[info]Allows for public read access to 'to' property. getTranslations() : array<string|int, mixed> >[info]Get the array of strings for the current language. has8bitChars() : bool >[info]Does a string contain any 8-bit chars (in any charset)? hasLineLongerThanMax() : bool >[info]Detect if a string contains a line longer than the maximum line length allowed by RFC 2822 section 2.1.1. hasMultiBytes() : bool >[info]Check if a string contains multi-byte characters. headerLine() : string >[info]Format a header line. html2text() : string >[info]Convert an HTML string into plain text. idnSupported() : bool >[info]Tells whether IDNs (Internationalized Domain Names) are supported or not. This requires the `intl` and `mbstring` PHP extensions. inlineImageExists() : bool >[info]Check if an inline attachment is present. isError() : bool >[info]Check if an error occurred. isHTML() : mixed >[info]Sets message type to HTML or plain. isMail() : mixed >[info]Send messages using PHP's mail() function. isQmail() : mixed >[info]Send messages using qmail. isSendmail() : mixed >[info]Send messages using $Sendmail. isSMTP() : mixed >[info]Send messages using SMTP. isValidHost() : bool >[info]Validate whether a string contains a valid value to use as a hostname or IP address. mb_pathinfo() : string|array<string|int, mixed> >[info]Multi-byte-safe pathinfo replacement. msgHTML() : string >[info]Create a message body from an HTML string. normalizeBreaks() : string >[info]Normalize line breaks in a string. parseAddresses() : array<string|int, mixed> >[info]Parse and validate a string containing one or more RFC822-style comma-separated email addresses of the form "display name <address>" into an array of name/address pairs. postSend() : bool >[info]Actually send a message via the selected mechanism. preSend() : bool >[info]Prepare a message for sending. punyencodeAddress() : string >[info]Converts IDN in given email address to its ASCII form, also known as punycode, if possible. quotedString() : string >[info]If a string contains any "special" characters, double-quote the name, and escape any double quotes with a backslash. rfcDate() : string >[info]Return an RFC 822 formatted date. secureHeader() : string >[info]Strip newlines to prevent header injection. send() : bool >[info]Create a message and send it. set() : bool >[info]Set or reset instance properties. setBoundaries() : void >[info]Set the boundaries to use for delimiting MIME parts. setFrom() : bool >[info]Set the From and FromName properties. setLanguage() : bool >[info]Set the language for error messages. setOAuth() : mixed >[info]Set an OAuthTokenProvider instance. setSMTPInstance() : SMTP >[info]Provide an instance to use for SMTP operations. setWordWrap() : mixed >[info]Apply word wrapping to the message body. sign() : mixed >[info]Set the public and private key files and password for S/MIME signing. smtpClose() : mixed >[info]Close the active SMTP session if one exists. smtpConnect() : bool >[info]Initiate a connection to an SMTP server. stripTrailingBreaks() : string >[info]Strip trailing line breaks from a string. stripTrailingWSP() : string >[info]Remove trailing whitespace from a string. textLine() : string >[info]Return a formatted mail line. utf8CharBoundary() : int >[info]Find the last character boundary prior to $maxLength in a utf-8 quoted-printable encoded string. validateAddress() : bool >[info]Check that a string looks like an email address. wrapText() : string >[info]Word-wrap message. addAnAddress() : bool >[info]Add an address to one of the recipient arrays or to the ReplyTo array. addOrEnqueueAnAddress() : bool >[info]Add an address to one of the recipient arrays or to the ReplyTo array. Because PHPMailer can't validate addresses with an IDN without knowing the PHPMailer::$CharSet (that can still be modified after calling this function), addition of such addresses is delayed until send(). attachAll() : string >[info]Attach all file, string, and binary attachments to the message. cidExists() : bool >[info]Check if an embedded attachment is present with this cid. doCallback() : mixed >[info]Perform a callback. edebug() : mixed >[info]Output debugging info via a user-defined method. encodeFile() : string >[info]Encode a file attachment in requested format. endBoundary() : string >[info]Return the end of a message boundary. fileIsAccessible() : bool >[info]Check whether a file path is safe, accessible, and readable. generateId() : string >[info]Create a unique ID to use for boundaries. getBoundary() : string >[info]Return the start of a message boundary. isPermittedPath() : bool >[info]Check whether a file path is of a permitted type. isShellSafe() : bool >[info]Fix CVE-2016-10033 and CVE-2016-10045 by disallowing potentially unsafe shell characters. lang() : string >[info]Get an error message in the current language. mailSend() : bool >[info]Send mail using the PHP mail() function. sendmailSend() : bool >[info]Send mail using the $Sendmail program. serverHostname() : string >[info]Get the server hostname. setError() : mixed >[info]Add an error message to the error container. setLE() : mixed >[info]Set the line break format string, e.g. "\r\n". setMessageType() : mixed >[info]Set the message type. smtpSend() : bool >[info]Send mail via SMTP. validateEncoding() : bool >[info]Validate encodings. getSmtpErrorMessage() : string >[info]Build an error message starting with a generic one and adding details if possible. mailPassthru() : bool >[info]Call mail() in a safe_mode-aware fashion.