사이트 내 전체검색
PHP
[PHP] UTF-8 웹페이지에서 일본어 메일보내기
로빈아빠
https://cmd.kr/php/656 URL이 복사되었습니다.

본문

Qdmail - PHP::Mail Library , Quick and Detailed for Multibyte

PHP로 일본어 메일 관련 프로그램
http://hal456.net/qdmail/  

SMTP 와 같이 사용하려면
http://hal456.net/qdsmtp/ 




<< 실전예제 >>

###### mail.php ######

<form name="mail_form" onSubmit="return input_check(this)" method="post" action="mail_proc.php">
<input type="hidden" name="LocalConfig" value="Default">
<input type="hidden" name="ToName" value="해피정">
<input type="hidden" name="ToMail" value="master@happyjung.com">
<input type="hidden" name="FromUserReceive" value="Y">
<table width="500" border="0" align="center" cellpadding="3" cellspacing="1" bgcolor="#CCBF99">
  <tr>
    <td width="100" height="35" align="center" bgcolor="#F3EACE">發信人 姓名</td>
    <td bgcolor="#FFFFFF"><input type="text" name="FromName" size="35" /></td>
  </tr>
  <tr>
    <td align="center" bgcolor="#F3EACE">發信人 E-mail</td>
    <td bgcolor="#FFFFFF"><input type="text" name="FromMail" size="35" /></td>
  </tr>
  <tr> 
    <td align="center" bgcolor="#F3EACE">發信人 Tel</td>
    <td bgcolor="#FFFFFF"><input name="tel" type="text" id="tel" size="20" /></td>
  </tr>
  <tr> 
    <td align="center" bgcolor="#F3EACE">受信人 E-mail</td>
    <td bgcolor="#FFFFFF">master@@happyjung.com </td>
  </tr>
  <tr> 
    <td align="center" bgcolor="#F3EACE">題 名</td>
    <td bgcolor="#FFFFFF"><input type="text" name="title" style="width:70%"></td>
  </tr>
  <tr> 
    <td align="center" bgcolor="#F3EACE">内 容</td>
    <td bgcolor="#FFFFFF"><textarea name="content" rows="10" style="width:95%"></textarea></td>
  </tr>
  <tr> 
    <td bgcolor="#FFFFFF" colspan="2" align="center"> <input name="Submit" type="Submit" value="發送"> &nbsp;&nbsp;&nbsp;&nbsp; <input name="reset" type="reset" value="取消"></td>
  </tr>
</table>
</form>



###### mail_proc.php ######

<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<?php
if(ereg("^http://(www.){0,1}happyjung.com/mail.php$", $_SERVER['HTTP_REFERER'])) {
  $copyright = "\n\n = 韓国旅行情報のご予約  http://www.happyjung.com = ";

  $FromMail   = $_POST['FromMail'];
  $FromName = $_POST['FromName'];
  $ToName    = $_POST['ToName'];
  $ToMail      = $_POST['ToMail']
 
/*  
//디비저장 시작
include_once "../gnuboard/dbconfig.php" ;
$dbconn = mysql_connect("$mysql_host","$mysql_user","$mysql_password") or die("DB Error");
@mysql_query("set names utf8"); // 한글문제해결을위하여 추가
mysql_select_db($mysql_db,$dbconn);

$query = "INSERT INTO hp_mail (num, name, tel, email, title, content, regdate) VALUES ('', '$FromName', '$tel', '$FromMail', '$title', '$content', now() ) ";
//echo "query => $query <br>";

$result=mysql_query($query,$dbconn);
echo mysql_error();
mysql_close($dbconn);
// 디비저장 끝
*/


require_once('qdmail.php');
  $tel     = "發信人 TEL : " . $tel . "\n\n";
  $to      = array( $ToMail , $ToName );
  $from    = array( $FromMail , $FromName );
  $subject = stripslashes($_POST['title']);
  $content = stripslashes($_POST['content']);
  $body    = $tel . $content . $copyright;

//echo "$content";

 qd_send_mail( 'text' , $to , $subject , $body , $from);

 echo "<script language='javascript'>alert('メールを発送しました。'); location.href='./mail.php';</script>";

} else {
 echo "<script language='javascript'>alert('No No No'); history.go(-2);</script>";
}
?>




참고자료
http://apmsetup.org/336 
http://hal456.net/qdmail/  
http://hal456.net/qdsmtp/ 

댓글목록

등록된 댓글이 없습니다.

PHP
871 (6/18P)

Search

Copyright © Cmd 명령어 18.191.202.48