sendmail2.php
上传用户:gdxydsw
上传日期:2020-07-21
资源大小:1k
文件大小:1k
源码类别:

WEB邮件程序

开发平台:

PHP

  1. <?php
  2. function sendMail($to, $subject, $body, $from_email) {
  3. $headers  = "MIME-Version: 1.0 n" ;
  4. $headers .= "From: " .
  5.        ""."<".$from_email."> n";
  6. $headers .= "Reply-To: " .
  7.        ""."<".$from_email."> n";
  8.  
  9.     
  10. $headers .= "Content-Type: text/plain;charset=ISO-2022-JP n";
  11. $body = mb_convert_encoding($body, "ISO-2022-JP","shift-jis");
  12.     
  13. $sendmail_params  = "-f$from_email";
  14.     
  15. mb_language("ja");
  16. $subject = mb_convert_encoding($subject, "ISO-2022-JP","AUTO");
  17. $subject = mb_encode_mimeheader($subject);
  18. $result = mail($to, $subject, $body, $headers, $sendmail_params);
  19.        
  20. return $result;
  21. }
  22. $to = "yourmail@yahoo.co.jp";
  23. $subject = "偍栤偄崌傢偣偑偁傝傑偟偨丅";
  24. $body = "柤慜n".$_POST['textfield']."nn儊乕儖傾僪儗僗n".$_POST['textfield2']."nn擭楊n".$_POST['radio']."nn惈暿n".$_POST['textfield3']."nn偍栤偄崌傢偣撪梕n".$_POST['textfield4'];
  25. $from_email = $_POST['textfield2'];
  26. sendMail($to, $subject, $body, $from_email);
  27. header("Location: index.html"); 
  28. ?>