PHP Email Class
1.0.0
此類別允許您使用 PHPMailer 庫和 SMTP 發送電子郵件。
內普森製造
require_once ' path/to/Email.php ' ;
若要傳送電子郵件,請使用sendMail()
方法。此方法採用以下參數:
$ email = new Email ( ' smtp.example.com ' , ' username ' , ' password ' , ' 587 ' , ' tls ' );
$ to = " [email protected] " ;
$ subject = " Test Email " ;
$ body = " This is a test email sent using PHPMailer. " ;
$ from = " [email protected] " ;
$ fromName = " Sender " ;
$ attachments = [ ' /path/to/file1.jpg ' , ' /path/to/file2.pdf ' ];
if ( $ email -> sendMail ( $ to , $ subject , $ body , $ from , $ fromName , $ attachments )) {
echo " Email sent successfully with attachments. " ;
} else {
echo " Failed to send email. " ;
}
您始終可以透過發出拉取請求並添加更多功能或修復錯誤來為課程做出貢獻。
此類是根據 MIT 許可證授權的開源軟體。