메일 계정 연동 채택완료
안녕하세요.
아래의 스크립트에 더 아래의 php를 이용하여 메일을 연동하려는데
잘 안되네요..
폼은 총 4개 입니다. 이름, 이메일, 주제, 메세지
받을 주소는 sales@shinilchain.com 입니다.
감사합니다.
Copy
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml" dir="ltr" lang="en-US"><head> <title>shinil에 오신걸 환영합니다.</title><link href="./css/reset.css" rel="stylesheet" type="text/css" /><link href="./css/style.css" rel="stylesheet" type="text/css" /><link rel="stylesheet" href="./css/nivo-default.css" type="text/css" media="screen" /><link rel="stylesheet" href="./css/nivo-slider.css" type="text/css" media="screen" /><script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js"></script><script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.14/jquery-ui.min.js"></script><script type="text/javascript" src="./js/contact.js"></script><script type="text/javascript" src="./js/superfish-menu/superfish.js"></script><script type="text/javascript" src="./js/nivo-slider/jquery.nivo.slider.pack.js"></script><script type="text/javascript" src="./js/jquery.easing.1.3.js"></script><script type="text/javascript" src="./js/jquery.asyncslider.js"></script><script type="text/javascript" src="./js/jquery.prettyPhoto.js"></script><script type="text/javascript" src="./js/custom.js"></script><script type="text/javascript" src="./js/twitter.js"></script><!--[if lt IE 9]> <script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script><![endif]--><meta charset="UTF-8"></head><body> <div class="top_line"> <div class="container"> <div class="rss"> 신일체인 Bring Us To Better Place And Better World!!! </div> <nav> <ul> <li id="login"> <a id="login-trigger" href="#"> Log in <span>▼</span> </a> <div id="login-content"> <form> <fieldset id="inputs"> <input id="username" type="email" name="Email" placeholder="Your email address" required> <input id="password" type="password" name="Password" placeholder="Password" required> </fieldset> <fieldset id="actions"> <input type="submit" id="submit" value="Log in"> <label><input type="checkbox" checked="checked"> 회원가입</label> </fieldset> </form> </div> </li> <li id="signup"> <a href="">로그인</a> </li> </ul> </nav> </div> </div> <!--Header--> <div class="container"> <div class="span-8"> <div id="logo"> <a href="./index.html"><img src="./images/logo.png" alt="Logo" /></a> </div> </div> <div class="span-16 last"> <ul id="menu"> <li class="active"><a href="./home-accordion.html">회사소개</a></li> <li><a href="#">제품소개</a> <ul> <li><a href="#">Brass Chains</a> <ul> <li><a href="./brass_1.html">Type-1</a></li> <li><a href="./brass_2.html">Type-2</a></li> <li><a href="./brass_3.html">Type-3</a></li> </ul> <li><a href="./hand.html">Handmade Chains</a> <li><a href="./iron.html">Iron Chains</a> <li><a href="./stain.html">Stainless Chains</a> <li><a href="./alu.html">Aluminium Chains</a> <li><a href="./finish.html">Finished Necklaces</a> <li><a href="#">Brass Claps</a> <li><a href="#">Jump Rings</a> <li><a href="#">Earring Parts</a> </ul> </li> <li><a href="./home-nivo.html">ODM 사업</a> </li> <li><a href="./contacts.html">contact</a></li> </ul> </div> <div class="span-24 separator"></div> <div class="span-24 subpage_title"> <a href="./index.html" class="home_icon"><img src="./images/1px.png" alt="" width="17px" height="16px" /></a><img class="sep" src="./images/dv.png" alt="" width="17px" height="16px" /> <p class="colored">Contacts</p> </div> <div class="span-24 separator notopmargin"></div> <div class="span-24"> <div class="map"><iframe class="bordered_img" width="920" height="350" frameborder="1" scrolling="no" marginheight="0" marginwidth="0" src="https://maps.google.com/maps?q=37.443665,127.178031&output=embed"></iframe></div> <div class="span-16 post_form"> <div id="note"></div> <fieldset class="info_fieldset"> <div id="fields"> <form id="ajax-contact-form" action="javascript:alert('Was send!');"> <div class="span-8 form notopmargin"> <input class="text" type="text" name="name" value="" placeholder="Name" required /><br /> </div> <div class="span-8 form last notopmargin"> <input class="text" type="text" name="email" value="" placeholder="E-mail" required /><br /> </div> <div class="span-16 last formtop"> <input class="texts" type="text" name="subject" value="" placeholder="Subject" required /><br /> </div> <div class="span-16 last"> <textarea class="text" name="message" rows="5" cols="25" placeholder="Message" required ></textarea><br /> </div> <div class="span-12 last notopmargin"> <input class="button" type="submit" name="submit" value="Send message" id="submit_form" required/> </div> </form> </div> </fieldset> </div> <div class="span-8 last"> <h4 class=" uppercase"><span class="colored">Contacnt</span> information</h4> <p>서울특별시 강동구 성내동 542-5<br/> <br/><span class="strong">전화:</span></span> <span class="colored">82-2-482-3190</span> <br/><span class="strong">팩스:</span> <span class="colored">82-2-482-3199</span> <br/><span class="strong">홈페이지:</span> <a class="link" href="">http://www.shinilchain.com</a> <br/><span class="strong">이메일:</span> <a class="link nobottommargin" href="">sales@shinilchain.com</a> </p> <p class="block_all small-italic">shinil만의 최첨단 기술력으로 여러분의 미래를 선도해드리겠습니다.</p> </div> </div> </div> <div class="clear"></div> <div class="footer"> <div class="container"> <div class="span-6 logo_area"> <a href="./index.html"><img src="./images/logo_footer.png" alt="Logo" /></a> <h6>운영시간 / 9:00 ~ 6:00</h6> <h6>점심시간 / 11:50 ~ 12:50</h6> <p>서울특별시 강동구 성내동 542-5</p> <div class="separator"></div> <div class="tweet-icon"> <a href="./index.html" class='social' title='Twitter'><img src="./images/1px.png" alt="" width="26px" height="26px" /></a> </div> <div class="facebook-icon"> <a href="./index.html" class='social' title='Facebook'><img src="./images/1px.png" alt="" width="26px" height="26px" /></a> </div> <div class="google-icon"> <a href="./index.html" class='social' title='Google +'><img src="./images/1px.png" alt="" width="26px" height="26px" /></a> </div> <div class="vimeo-icon"> <a href="./index.html" class='social' title='Vimeo'><img src="./images/1px.png" alt="" width="26px" height="26px" /></a> </div> <div class="dribbble-icon"> <a href="./index.html" class='social' title='Dribbble'><img src="./images/1px.png" alt="" width="26px" height="26px" /></a> </div> </div> <div class="span-6"> <h5 class="footer_welcome"><span class="colored">신일체인</span> 금속체인</h5> <div class="span-6 separator"></div> <p>럭셔리한 금속 아티스트로 신일체인이 함께 하겠습니다..</p> <p class="small-italic highlight"><a href="#"> Follow me</a> to be notified for updates!</p> </div> <div class="span-6 posts"> <h5 class="footer_welcome"><span class="colored">고객</span>후기</h5> <div class="span-6 separator"></div> <h6 class="blog_title colored"><a href="#">세상에서 가장 아름다운 금속체인</a></h6> <p>고객들의 요구에 맞추어서 최선을 다해서 노력하겠습니다.</p> <h6 class="blog_title colored"><a href="#">고급스러운 디자인</a></h6> <p>여러분을 최고의 VIP로 만들어 드리겠습니다.</p> </div> <div class="span-6 last"> <h5 class="footer_welcome"><span class="colored">트위터</span> 소식</h5> <div class="span-6 separator"></div> <div id="jstwitter"> </div> </div> </div> <div class="clear"></div> </div> <!--End Footer--> </body> </html>
Copy
<?$conf['charset'] = "utf-8"; $name = $_POST['contactName']; // 보내는 사람 이름$email_from = $_POST['email']; // 보내는 사람 메일$email_to = "sales@shinilchain.com"; // 받는 사람 메일 //$file_path = $_FILES['files'][tmp_name]; // file path//$file_name = $_FILES['files'][name]; // file 이름//$attach[0] = attach_file($file_name, $file_path); // 파일 내용 읽어서 메일에 첨부 $now=time(); $subject = date("Y-m-d H:i:s", $now)."] ".$name."이 문의글을 작성하셨습니다."; // 제목$content = date("Y-m-d H:i:s", $now)."<br>".$_POST['comments']; // 내용 //mailer($name, $email_from, $email_to, $subject, $content, $type=2, $attach); // 메일발송mailer($name, $email_from, $email_to, $subject, $content, $type=2); // 메일발송 echo "<meta http-equiv='content-type' content='text/html; charset=utf-8'>";echo "<script type=''text/javascript'><!--alert('메일발송 완료');location.href='index.html';//--></script>";//echo "<script>alert('메일발송 완료');location.href='index.html';</script>"; // type : text=0, html=1, text+html=2//function mailer($name, $mail, $to, $subject, $content, $type=2, $file)function mailer($name, $mail, $to, $subject, $content, $type=2){ global $conf; $name = "=?$conf[charset]?B?" . base64_encode($name) . "?="; $subject = "=?$conf[charset]?B?" . base64_encode($subject) . "?="; $header = "Return-Path: <$mail>\n"; $header .= "From: $name <$mail>\n"; $header .= "Reply-To: <$mail>\n"; $header .= "MIME-Version: 1.0\n"; if ($file != "") { $boundary = uniqid("http://localhost"); $header .= "Content-type: MULTIPART/MIXED; BOUNDARY=\"$boundary\"\n\n"; $header .= "--$boundary\n"; } if ($type) { $header .= "Content-Type: TEXT/HTML; charset=$conf[charset]\n"; if ($type == 2) { $content = nl2br($content); } } else { $header .= "Content-Type: TEXT/PLAIN; charset=$conf[charset]\n"; $content = stripslashes($content); } $header .= "Content-Transfer-Encoding: BASE64\n\n"; $header .= chunk_split(base64_encode($content)) . "\n"; if ($file != "") { for($i=0;$i<3;$i++) { if($file[$i]['name'] == '') { continue; } $fn = $file[$i]['name']; $header .= "\n--$boundary\n"; $header .= "Content-Type: application/octet-stream\n"; $header .= "Content-Transfer-Encoding: BASE64\n"; $header .= "Content-Disposition: attachment; filename=\"$fn\"\n"; $header .= "\n"; $header .= base64_encode($file[$i][data]); $header .= "\n"; } $header .= "--$boundary--\n"; } @mail($to, $subject, "", $header,'-f'.$mail);} function attach_file($name, $file){ $fp = fopen($file, "r"); $tmpfile = array( "name" => $name, "data" => fread($fp, filesize($file)) ); fclose($fp); return $tmpfile;}?>
답변을 작성하려면 로그인이 필요합니다.
로그인