최근에 도메인과 호스팅을 구입했습니다. 또한 웹 페이지에 문의 양식이 작성되었습니다. 사용자가 문의 양식의 텍스트 영역에 글을 쓰고 을 클릭하고을 제출하면 메시지가 내 Gmail 계정으로 전송되어 해당 메시지에도 회신 할 수 있습니다. 또한이 스크립트를 사용하여 작동하지만 작동하지 않습니다.php 문의 양식을 통한 메일 송수신
이다 sendemail.php 파일
<?php
header('Content-type: application/json');
$status = array(
'type'=>'success',
'message'=>'Thank you for contact us. As early as possible we will contact you '
);
$name = @trim(stripslashes($_POST['name']));
$email = @trim(stripslashes($_POST['email']));
$subject = @trim(stripslashes($_POST['subject']));
$message = @trim(stripslashes($_POST['message']));
$email_from = $email;
$email_to = '[email protected]';//replace with your email
$body = 'Name: ' . $name . "\n\n" . 'Email: ' . $email . "\n\n" . 'Subject: ' . $subject . "\n\n" . 'Message: ' . $message;
$success = @mail($email_to, $subject, $body, 'From: <'.$email_from.'>');
echo json_encode($status);
die;
이 의 index.php
<div class="contact" id="contact">
<div class="container-3x">
<div class="block-header"> <!-- Blocks Header -->
<h2 class="title">Contact Us</h2>
</div>
<div class="block-content"> <!-- Blocks Content -->
<form action="sendemailphp" method="post" class="trigger-form-animate">
<input type="text" value="" id="name" name="name" placeholder="Name *" />
<input type="text" value="" id="email" name="email" placeholder="Email *" />
<input type="text" value="" id="website" name="website" placeholder="Website *" />
<textarea type="text" value="" id="message" name="message" rows="3" placeholder="Your Message *" ></textarea>
<div class="clr"></div>
<button>Submit Message</button>
</form>
</div>
</div>
</div>
나는 또한 시도했다 "http://www.mybloggertricks.com/2012/06/connect-your-website-email-address-to.html"이 튜토리얼 내 연락처 양식 코드 하지만 작동하지 않습니다. "Gmail을 통해 전송 (설정이 용이함)"다른 계정을 추가 할 때 gmail에서이 옵션을 찾을 수 없습니다.
어떻게 할 수 있습니까 ?? Plzz
억제 오류 @'사용하여 원인을 도와'하지 않습니다 [** 그들에 대한 검사 **] (http://php.net/ manual/en/function.error-reporting.php)를 사용하십시오. –
네,'@'를 제거하고'error_reporting (E_ALL);과'display_errors (1);'을 사용하자'var_dump ($ success);'true 또는 false입니까? – vaso123
남자들은 PHP에 대해 많이 모른다. http://shapebootstrap.net/item/evento-free-music-event-template/에서 sendemail.php 파일을 가지고있는 evento 템플릿을 다운로드했다. 나는 이메일 주소를 내 이메일로 바꿨고이 파일을 다른 템플릿에서 사용하여 내 서버에 파일을 업로드했지만 메시지를 제출할 때 "성공"을 표시했지만 Gmail 계정에는 아무런 메시지도받지 못했습니다. –