Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- require_once('./phpmailer/PHPMailerAutoload.php');
- $mail= new PHPMailer(); //建立新物件
- $mail->IsSMTP(); //設定使用SMTP方式寄信
- $mail->SMTPAuth = true; //設定SMTP需要驗證
- $mail->SMTPSecure = "ssl"; // Gmail的SMTP主機需要使用SSL連線
- $mail->Host = "ssl://smtp.gmail.com"; //Gamil的SMTP主機
- $mail->Port = 465; //Gamil的SMTP主機的埠號(Gmail為465)。
- $mail->CharSet = "utf-8"; //郵件編碼
- $mail->Username = "leo604leo604@gmail.com"; //Gamil帳號
- $mail->Password = ""; //Gmail密碼
- $mail->From = "leo604leo604@gmail.com"; //寄件者信箱
- $mail->FromName = "leo604leo604"; //寄件者姓名
- $mail->Subject ="Test"; //郵件標題
- $mail->Body = "Test mail"; //郵件內容
- $mail->IsHTML(true); //郵件內容為html
- $mail->AddAddress("leo604leo604@gmail.com"); //收件者郵件及名稱
- if(!$mail->Send()){
- echo "Error: " . $mail->ErrorInfo;
- }else{
- echo "<b>感謝您的留言,您的建議是我們前進的動力。</b>";
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement