<?php
/*
include "mime_mail.inc";
$filename = "testfile.jpg";
$content_type = "image/jpeg";
# 讀取磁碟裡的 jpeg 圖形
$fd = fopen($filename, "r");
$data = fread($fd, filesize($filename));
fclose($fd);
# 建立物件實體
$mail = new mime_mail;
# 設定所有項目
$mail->from = "your@address.com";
$mail->to = "recipient@remote.net";
$mail->subject = "歡迎!";
$mail->body = "這是真正的電子郵件訊息,
當然….你可以寫成一行以上。";
# 加上附檔
$mail->add_attachment($data, $filename, $content_type);
# 送出電子郵件
$mail->send();
*/
?>
<html>
<body>
<?
// by hsu
if (!preg_match("!^(http://)?" . getenv("server_name") . "!", getenv("http_referer")) ||
!preg_match("/^.+@.+\..+/", $myemail)) {
echo "<form action=\"$php_self\" method=\"post\">\n";
echo "your e-mail addr: <input type=\"text\" name=\"myemail\" size=\"30\">\n";
echo "<input type=\"submit\" value=\"寄件測試(含附件)\">\n";
echo "</form>\n";
} else {
include "mime_mail.inc";
$filename = "php_logo.gif";
$content_type = "image/gif";
# 讀取磁碟裡的 jpeg 圖形
$fd = fopen($filename, "r");
$data = fread($fd, filesize($filename));
fclose($fd);
# 建立物件實體
$mail = new mime_mail;
# 設定所有項目
$mail->from = $myemail;
$mail->to = $myemail;
$mail->subject = "歡迎!";
$mail->body = "這是真正的電子郵件訊息,\n" .
"當然….你可以寫成一行以上。";
# 加上附檔
$mail->add_attachment($data, $filename, $content_type);
# 送出電子郵件
$mail->send();
echo "郵件已送出,請檢查您的信箱。";
}
?>
</body>
</html>
