嘿嘿,我說的可是利用 php 裡面的 libcurl 方式,把資料傳到 gmail 去,讓 gmail 當你的 smtp 呢!
這裡下載 libgmailer
以下是範例程式:
require("libgmailer.php");
$gmail_acc = "帳號@gmail.com";
$gmail_pwd = "密碼";
$my_timezone = "GMT +08:00";
$gmailer = new GMailer();
if ($gmailer->created) {
$gmailer->setLoginInfo($gmail_acc, $gmail_pwd, $my_timezone);
// $gmailer->setProxy("proxy.company.com");
if ($gmailer->connect()) {
// GMailer connected to Gmail successfully.
// Do something with it.
$to = "收件人@gmail.com";
$subj = "主題";
$body = "測試";
$gmailer->send($to, $subj, $body, $cc="", $bcc="", $mid="", $tid="", $files=0, $draft=false, $orig_df="", $is_html=0, $from="", $attachments = array());
} else {
die("Fail to connect because: ".$gmailer->lastActionStatus()."\n");
}
} else {
die("Failed to create GMailer because: ".$gmailer->lastActionStatus()."\n");
}