달력

42024  이전 다음

  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
function getUTFtoKR($str)
{
   return iconv('utf-8','euc-kr',$str);
}



//이메일전송
function getSendMail($to,$from,$subject,$content,$html) 
{

   if ($html == 'TEXT') $content = nl2br(htmlspecialchars($content));
   $to_exp   = explode('|', $to);
   $from_exp = explode('|', $from);
   $To = $to_exp[1] ? "\"".getUTFtoKR($to_exp[1])."\" <$to_exp[0]>" : $to_exp[0];
   $Frm = $from_exp[1] ? "\"".getUTFtoKR($from_exp[1])."\" <$from_exp[0]>" : $from_exp[0];
   $Header = "From:$Frm\nReply-To:$frm\nX-Mailer:PHP/".phpversion();
   $Header.= "\nContent-Type:text/html;charset=EUC-KR\r\n"; 
   return @mail($To,getUTFtoKR($subject),getUTFtoKR($content),$Header);
}

 

 

 

getUTFtoKR 이 펑션을 사용하는건 인코딩 타입이 UTF8 인 경우 한글은 EUC-KR 로 변형 시켜주기 위해서 사용하는것

 

예제

 

getSendMail("exmple@google.com|홍길동","exmple|관리자","제목","내용","HTML");

 

 

일반적인 웹 호스팅 업체를 사용할경우 메일발송서버가 설치되어있습니다.

'Dev Language > PHP' 카테고리의 다른 글

PHP 실시간 접속 세션 저장  (0) 2015.06.02
PHP 문자열 인코딩 utf8,euc-kr 펑션  (0) 2015.06.02
PHP 배열 사용  (0) 2015.06.02
QR 코드 생성기  (0) 2015.02.16
MYSQL 단일 파일 웹접속용  (0) 2013.01.24
Posted by 타카스 류지
|