0. 데이터 입력
<?php header("Content-Type:text/html;charset=UTF-8"); ////////////////////////////////////// // 고정 정보 : 절대 수정하지 마십시오. ////////////////////////////////////// $config->w_serv_url = 'woorimail.com'; $config->w_type = 'api'; $config->w_mid = 'auth_woorimail'; $config->w_act = 'dispWwapimanagerMailApi'; $config->w_domain = 'woorimail.com'; /////////////// // 고정 정보 끝 /////////////// // Y : 443 or 20080 , N : 80 $config->w_ssl = 'Y'; $config->w_ssl_port = '443'; $config->w_authkey = 'thisisyourwoorimailauthkey'; $config->w_title = '이메일 제목'; $config->w_content = '<div style="color:red;">이메일 내용</div>'; $config->w_receiver_nickname = '받는이1,받는이2,받는이3'; $config->w_receiver_email = 're1@mydomain.com,re2@mydomain.com,re3@mydomain.com'; $config->w_member_regdate = '20130102030405,20140102030405,20150102030405'; $config->w_sender_email = 'real-reply@mydomain.com'; $config->w_sender_nickname = '회신메일'; // 전용채널인 경우 전용채널 도메인 입력 $config->w_wms_domain = 'woorimail.com'; $config->w_wms_nick = 'webmaster'; $config->w_type = 'test'; $config->w_callback = ''; $w_serv_url = $config->w_serv_url; if($config->w_ssl == 'N' || !$config->w_ssl) { $w_ssl = 'http://'; $w_ssl_port = ''; } elseif($config->w_ssl == 'Y') { $w_ssl = 'https://'; $w_ssl_port = ':' . $config->w_ssl_port; } $url = $w_ssl . $w_serv_url . $w_ssl_port . '/index.php'; ?>
1. HTML의 form 방식 전송
<html> <head> <title>우리메일(http://woorimail.com) 예제</title> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> </head> <body> <form action="<?=$url?>" method="post"> <input type="hidden" name="act" value="<?=$config->w_act?>" /> <input type="hidden" name="authkey" value="<?=$config->w_authkey?>" /> <input type="hidden" name="mid" value="<?=$config->w_mid?>" /> <input type="hidden" name="domain" value="<?=$config->w_domain?>" /> <input type="hidden" name="type" value="<?=$config->w_type?>" /> <input type="hidden" name="title" value="<?=$config->w_title?>" /> <input type="hidden" name="content" value="<?=htmlspecialchars($config->w_content)?>" /> <input type="hidden" name="sender_nickname" value="<?=$config->w_sender_nickname?>" /> <input type="hidden" name="sender_email" value="<?=$config->w_sender_email?>" /> <input type="hidden" name="receiver_nickname" value="<?=$config->w_receiver_nickname?>" /> <input type="hidden" name="receiver_email" value="<?=$config->w_receiver_email?>" /> <input type="hidden" name="member_regdate" value="<?=$config->w_member_regdate?>" /> <input type="hidden" name="wms_domain" value="<?=$config->w_wms_domain?>" /> <input type="hidden" name="wms_nick" value="<?=$config->w_wms_nick?>" /> <input type="hidden" name="callback" value="<?=$config->w_callback?>" /> <input type="submit" value="Send Mail" /> </form> </body> </html>
2. cURL 방식 전송
<?php $post_data = array( 'act' => $config->w_act, 'authkey' => $config->w_authkey, 'mid' => $config->w_mid, 'domain' => $config->w_domain, 'type' => $config->w_type, 'title' => $config->w_title, 'content' => $config->w_content, 'sender_nickname' => $config->w_sender_nickname, 'sender_email' => $config->w_sender_email, 'receiver_nickname' => $config->w_receiver_nickname, 'receiver_email' => $config->w_receiver_email, 'member_regdate' => $config->w_member_regdate, 'wms_domain' => $config->w_wms_domain, 'wms_nick' => $config->w_wms_nick, 'callback' => $config->w_callback ); $ch = curl_init(); curl_setopt($ch, CURLOPT_URL,$url); curl_setopt($ch, CURLOPT_POST,1); curl_setopt($ch, CURLOPT_POSTFIELDS,$post_data); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); if($config->w_ssl == 'Y') { curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 1); curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 2); } $response = curl_exec($ch); curl_close($ch); echo $response; ?>
3. 결과값
callback이 없다면 결과값은 json 으로 표현됩니다.
정상 처리되었을 경우 json
{"result":"OK","error_msg":""}
테스트 정상 통과 하였을 경우 json
{"result":"testOK","error_msg":""}
에러일 경우 json
{"result":"fail","error_msg":"me_000"}