標籤:style blog color 使用 os for ar 代碼
PHPMailer是一個用於寄送電子郵件的PHP函數包。它提供的功能包括:在發送郵時指定多個收件者,抄送地址,暗送地址和回複地址、支援多種郵件編碼包括:8bit,base64,binary和quoted-printable、支援SMTP驗證、支援帶附件的郵件和Html格式的郵件。
實現代碼 :
<?phpinclude ‘class.smtp.php‘;include ‘class.phpmailer.php‘;$mail = new PHPMailer;$mail->isSMTP(); // 開啟SMTP服務$mail->Host = ‘smtp.xx.com‘; // SMTP 伺服器位址 各大郵箱都可以使用SMTP 並有詳細說明$mail->SMTP_PORT = 25; // SMTP 服務連接埠 預設為25$mail->SMTPAuth = true; // 開啟SMTP認證$mail->Username = ‘[email protected]‘; // 郵箱帳號$mail->Password = ‘......‘; // 郵箱密碼$mail->From = ‘[email protected]‘; //寄件匣 應該和 使用者名稱一致$mail->FromName = ‘Mailer‘; //寄件者稱呼$mail->addAddress(‘[email protected]‘, ‘稱呼‘); // 收件者地址及稱呼$mail->WordWrap = 50; //增加附件 如果有請在此設定//$mail->addAttachment(‘/tmp/image.jpg‘, ‘new.jpg‘);$mail->isHTML(true); // 使用HTML 形式的郵件$mail->Subject = ‘Here is the subject‘; //郵件標題$mail->Body = ‘This is the HTML message body <b>in bold!</b>‘; //郵件內容$mail->AltBody = ‘This is the body in plain text for non-HTML mail clients‘; //郵件提示if(!$mail->send()){ echo ‘Message could not be sent.‘; echo ‘Mailer Error: ‘ . $mail->ErrorInfo;} else { echo ‘Message has been sent‘;}?>