우선 php.net 에 나오는 예제는:
<?php
// 전달 하시고 싶은 내용은 여기에.
$message = "Line 1\nLine 2\nLine 3";
// In case any of our lines are larger than 70 characters, we should use wordwrap() 이건 line 이 길어질 경우,
$message = wordwrap($message, 70);
// Send
mail('caffeinated@example.com', 'My Subject', $message);
?>
php.net 에 이런식으로 설명이 되어 있는데,
저는
<?php
$to = 'xxxx@gmail.com , '.$_POST['email'];
$header .= "Content-Type: text/html; charser=UTF-8 \r\n";
$subject = 'Thank you for your purchase';
.
.
.
이런식으로 이메일을 보냅니다. 두번째 줄 $header 는 필요한 사항이 아니지만, html 이나 css 로 이메일을 예쁘게 만들기 위해, 그리고 한국어로 이메일을 보내기위해 utf-8 이 적용되기 위해 필요한 것 입니다.
이게 전부입니다. 우선 이 매우 간단한 기본으로 카트 address.php 에 넣어서 이메일을 보내보시고, 그후, 다른 내용들을 넣으시면 됩니다.
$message
$purchase (구매내역이 되겠죠.) 이런식으로 원하는 내용을 무한정 넣으실 수 있습니다. 아주 간단해요.
$nothing 이렇게 그냥 아무 이름이나 만드셔도 됩니다.
일단 간단한 것부터 해보시고, 이메일 제대로 발송되는지 test 하신후, html, css 등을 넣어서 이메일을 예쁘게 꾸미시면 됩니다.
이상. 카트 잘 쓰세요.
이게 이해가 안되시면, 처음부터 끝까지 html email 이 다나와 있는 예제를 통째로 가져다 이메일 주소만 바꿔서 적용해 보세요.
<?php
// multiple recipients
$to = 'aidan@example.com' . ', '; // note the comma
$to .= 'wez@example.com';
// subject
$subject = 'Birthday Reminders for August';
// message
$message = '
<html>
<head>
<title>Birthday Reminders for August</title>
</head>
<body>
<p>Here are the birthdays upcoming in August!</p>
<table>
<tr>
<th>Person</th><th>Day</th><th>Month</th><th>Year</th>
</tr>
<tr>
<td>Joe</td><td>3rd</td><td>August</td><td>1970</td>
</tr>
<tr>
<td>Sally</td><td>17th</td><td>August</td><td>1973</td>
</tr>
</table>
</body>
</html>
';
// To send HTML mail, the Content-type header must be set
$headers = 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
// Additional headers
$headers .= 'To: Mary <mary@example.com>, Kelly <kelly@example.com>' . "\r\n";
$headers .= 'From: Birthday Reminder <birthday@example.com>' . "\r\n";
$headers .= 'Cc: birthdayarchive@example.com' . "\r\n";
$headers .= 'Bcc: birthdaycheck@example.com' . "\r\n";
// Mail it
mail($to, $subject, $message, $headers);
?>
// multiple recipients
$to = 'aidan@example.com' . ', '; // note the comma
$to .= 'wez@example.com';
// subject
$subject = 'Birthday Reminders for August';
// message
$message = '
<html>
<head>
<title>Birthday Reminders for August</title>
</head>
<body>
<p>Here are the birthdays upcoming in August!</p>
<table>
<tr>
<th>Person</th><th>Day</th><th>Month</th><th>Year</th>
</tr>
<tr>
<td>Joe</td><td>3rd</td><td>August</td><td>1970</td>
</tr>
<tr>
<td>Sally</td><td>17th</td><td>August</td><td>1973</td>
</tr>
</table>
</body>
</html>
';
// To send HTML mail, the Content-type header must be set
$headers = 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
// Additional headers
$headers .= 'To: Mary <mary@example.com>, Kelly <kelly@example.com>' . "\r\n";
$headers .= 'From: Birthday Reminder <birthday@example.com>' . "\r\n";
$headers .= 'Cc: birthdayarchive@example.com' . "\r\n";
$headers .= 'Bcc: birthdaycheck@example.com' . "\r\n";
// Mail it
mail($to, $subject, $message, $headers);
?>
이러지말고 그냥 address.php 를 공개해달라고 하시는데.. 저는 개발자가 아니고 취미생활 하는 사람입니다. 제 address.php 에는 이메일 말고도 AJAX 로 불러오는 여러가지 line 들이 들어 있어서 누가보면 저거 발로 쓴거냐고 웃으실거에요. 쪽팔려서 공개 못합니다. -..-;;
그리고, 더 중요한 이유는 개발자분들 때문입니다. 개발자분께 의뢰하시면 구매내역 이메일로 보내주는거 만드시는거는 정말 10분도 안걸립니다. 이걸 몇주가 지나도록 해결못보셨으면, 그냥 약간의 사례비를 주시고 개발자 분께 맡기세요. 30분이면 만들어서 보내주실거에요.
저는 제가 개발자도 아니고, 개발자분들 밥상에 재뿌리는 일은 하고 싶지가 않습니다. -..-;;
시간을 들여 방법을 배우시건가, 돈을 내시던가, 둘중 하나 하시면 됩니다. 가급적이면 개발자분들에게도 이익이 생기는, 의뢰자, 개발자 서로 공생하는, 쪽이 되길 바라는 마음입니다.
제 카트를 통째로 가져다가 쓰시면 개발자분들에게는 아무런 이익이 생기지 않잖아요..
댓글 2개
게시글 목록
| 번호 | 제목 |
|---|---|
| 384 | |
| 12508 |
JavaScript
서버시간 알아내기
|
| 383 | |
| 381 | |
| 20395 | |
| 12507 | |
| 12506 | |
| 12505 | |
| 12504 |
웹서버
서버 동시접속자 설정 변경하기
|
| 12503 | |
| 12502 | |
| 12500 | |
| 12499 | |
| 12498 |
MySQL
테이블 복사 쿼리
|
| 20392 | |
| 12497 |
PHP
현재 접속중인 사용자 나타내기
|
| 12496 |
MySQL
mysql select 후 update 하기
|
| 12495 | |
| 12494 |
PHP
한글문자열 자르는 법 입니다.
|
| 12493 | |
| 12492 | |
| 12491 |
PHP
이메일주소 검사하기 입니다.
|
| 12490 | |
| 12489 | |
| 12488 |
node.js
Node js 게시판 프로젝트 소개합니다.
|
댓글 작성
댓글을 작성하시려면 로그인이 필요합니다.
로그인하기