Có, PHPMailer là một lựa chọn rất tốt. Ví dụ, nếu bạn muốn, bạn có thể sử dụng googles máy chủ SMTP miễn phí (nó giống như gửi từ tài khoản gmail của bạn.), Hoặc bạn chỉ có thể bỏ qua phần smtp và gửi nó như một cuộc gọi thư() điển hình, nhưng với tất cả các tiêu đề chính xác, vv Nó cung cấp nhiều e-mail, file đính kèm.
Cũng rất dễ thiết lập.
<?php
$mail = new PHPMailer(true);
//Send mail using gmail
if($send_using_gmail){
$mail->IsSMTP(); // telling the class to use SMTP
$mail->SMTPAuth = true; // enable SMTP authentication
$mail->SMTPSecure = "ssl"; // sets the prefix to the servier
$mail->Host = "smtp.gmail.com"; // sets GMAIL as the SMTP server
$mail->Port = 465; // set the SMTP port for the GMAIL server
$mail->Username = "[email protected]"; // GMAIL username
$mail->Password = "your-gmail-password"; // GMAIL password
}
//Typical mail data
$mail->AddAddress($email, $name);
$mail->SetFrom($email_from, $name_from);
$mail->Subject = "My Subject";
$mail->Body = "Mail contents";
try{
$mail->Send();
echo "Success!";
} catch(Exception $e){
//Something went bad
echo "Fail - " . $mail->ErrorInfo;
}
?>
Nguồn
2011-02-10 23:07:50
Tôi đang sử dụng một cái gì đó như thế atm – dynamic
Vì vậy ... điều này sử dụng SMTP và SSL? –
@Sortofabeginner chỉ xem mã :) –