Contact form PHP file not set properly for SMTP email and not sendingSending email in .NET through GmailSend email using the GMail SMTP server from a PHP pageReference — What does this symbol mean in PHP?PHP Contact Form Submitting RandomlyPHP attachment in contact formphp contact form send to specific email depends on user selected optionEmail PHP Contact Form error as random outputContact form sends email but without user inputscontact form php failedContact form email sends, but the message is in the subject

What verb for taking advantage fits in "I don't want to ________ on the friendship"?

Russian equivalents of 能骗就骗 (if you can cheat, then cheat)

Journal standards vs. personal standards

Avoiding repetition when using the "snprintf idiom" to write text

Why wasn't ASCII designed with a contiguous alphanumeric character order?

How do I keep a running total of data in a column in Excel?

Customs and immigration on a USA-UK-Sweden flight itinerary

Why isn't UDP with reliability (implemented at Application layer) a substitute of TCP?

Having to constantly redo everything because I don't know how to do it

What are the children of two Muggle-borns called?

Perform mirror symmetry transformation of 3D model (in OBJ)

Is it advisable to inform the CEO about his brother accessing his office?

What prevents a US state from colonizing a smaller state?

Can I take Amul cottage cheese from India to Netherlands?

How did they film the Invisible Man being invisible in 1933?

Why is my 401k manager recommending me to save more?

Calculus, water poured into a cone: Why is the derivative non-linear?

How to count the number of bytes in a file, grouping the same bytes?

I agreed to cancel a long-planned vacation (with travel costs) due to project deadlines, but now the timeline has all changed again

What was the first science fiction or fantasy multiple choice book?

Why would Dementors torture a Death Eater if they are loyal to Voldemort?

Where to connect the fuse and why?

Dynamic Sql Query - how to add an int to the code?

Do electrons really perform instantaneous quantum leaps?



Contact form PHP file not set properly for SMTP email and not sending


Sending email in .NET through GmailSend email using the GMail SMTP server from a PHP pageReference — What does this symbol mean in PHP?PHP Contact Form Submitting RandomlyPHP attachment in contact formphp contact form send to specific email depends on user selected optionEmail PHP Contact Form error as random outputContact form sends email but without user inputscontact form php failedContact form email sends, but the message is in the subject













-1















I've set up an email form on my site, added the php file, but it won't send the form to my email address. I contacted my webhost and they replied with "You would need to use a script which supports SMTP for sending not sendmail() which is what the current script is using". What does this mean? Have I set up my php file wrong? I've included my php file below. The form is currently hosted here http://www.rockclick.co.uk/contact.htm



<script><?php
$name = $_POST['name'];
$email = $_POST['email'];
$message = $_POST['message'];
$subject = $_POST['subject'];
header('Content-Type: application/json');
if ($name === '')
print json_encode(array('message' => 'Name cannot be empty', 'code' => 0));
exit();

if ($email === '')
print json_encode(array('message' => 'Email cannot be empty', 'code' => 0));
exit();
else
if (!filter_var($email, FILTER_VALIDATE_EMAIL))
print json_encode(array('message' => 'Email format invalid.', 'code' => 0));
exit();


if ($subject === '')
print json_encode(array('message' => 'Subject cannot be empty', 'code' => 0));
exit();

if ($message === '')
print json_encode(array('message' => 'Message cannot be empty', 'code' => 0));
exit();

$content="From: $name nEmail: $email nMessage: $message";
$recipient = "enquiries@rockclick.co.uk";
$mailheader = "From: $email rn";
mail($recipient, $subject, $content, $mailheader) or die("Error!");
print json_encode(array('message' => 'Email successfully sent!', 'code' => 1));
exit();
?></script>









share|improve this question






















  • why use the script tags for php?

    – pr1nc3
    Mar 25 at 15:47











  • I thought I had to?

    – Jo Tidman
    Mar 25 at 15:48











  • OK I removed the <script> tags but it's still not working!

    – Jo Tidman
    Mar 25 at 15:51











  • You would need to use a script which supports SMTP for sending not sendmail() which is what the current script is using they already told you what the problem is. the mail functions uses the tool sendmail by default. I'd recommend to use some library for email stuff; e.g. PHPMailer

    – kuh-chan
    Mar 25 at 15:54











  • Added an answer to your question. If my explanation is not clear please attach your code that you actually pass the values to the backend so i can explain further.

    – pr1nc3
    Mar 25 at 15:56















-1















I've set up an email form on my site, added the php file, but it won't send the form to my email address. I contacted my webhost and they replied with "You would need to use a script which supports SMTP for sending not sendmail() which is what the current script is using". What does this mean? Have I set up my php file wrong? I've included my php file below. The form is currently hosted here http://www.rockclick.co.uk/contact.htm



<script><?php
$name = $_POST['name'];
$email = $_POST['email'];
$message = $_POST['message'];
$subject = $_POST['subject'];
header('Content-Type: application/json');
if ($name === '')
print json_encode(array('message' => 'Name cannot be empty', 'code' => 0));
exit();

if ($email === '')
print json_encode(array('message' => 'Email cannot be empty', 'code' => 0));
exit();
else
if (!filter_var($email, FILTER_VALIDATE_EMAIL))
print json_encode(array('message' => 'Email format invalid.', 'code' => 0));
exit();


if ($subject === '')
print json_encode(array('message' => 'Subject cannot be empty', 'code' => 0));
exit();

if ($message === '')
print json_encode(array('message' => 'Message cannot be empty', 'code' => 0));
exit();

$content="From: $name nEmail: $email nMessage: $message";
$recipient = "enquiries@rockclick.co.uk";
$mailheader = "From: $email rn";
mail($recipient, $subject, $content, $mailheader) or die("Error!");
print json_encode(array('message' => 'Email successfully sent!', 'code' => 1));
exit();
?></script>









share|improve this question






















  • why use the script tags for php?

    – pr1nc3
    Mar 25 at 15:47











  • I thought I had to?

    – Jo Tidman
    Mar 25 at 15:48











  • OK I removed the <script> tags but it's still not working!

    – Jo Tidman
    Mar 25 at 15:51











  • You would need to use a script which supports SMTP for sending not sendmail() which is what the current script is using they already told you what the problem is. the mail functions uses the tool sendmail by default. I'd recommend to use some library for email stuff; e.g. PHPMailer

    – kuh-chan
    Mar 25 at 15:54











  • Added an answer to your question. If my explanation is not clear please attach your code that you actually pass the values to the backend so i can explain further.

    – pr1nc3
    Mar 25 at 15:56













-1












-1








-1








I've set up an email form on my site, added the php file, but it won't send the form to my email address. I contacted my webhost and they replied with "You would need to use a script which supports SMTP for sending not sendmail() which is what the current script is using". What does this mean? Have I set up my php file wrong? I've included my php file below. The form is currently hosted here http://www.rockclick.co.uk/contact.htm



<script><?php
$name = $_POST['name'];
$email = $_POST['email'];
$message = $_POST['message'];
$subject = $_POST['subject'];
header('Content-Type: application/json');
if ($name === '')
print json_encode(array('message' => 'Name cannot be empty', 'code' => 0));
exit();

if ($email === '')
print json_encode(array('message' => 'Email cannot be empty', 'code' => 0));
exit();
else
if (!filter_var($email, FILTER_VALIDATE_EMAIL))
print json_encode(array('message' => 'Email format invalid.', 'code' => 0));
exit();


if ($subject === '')
print json_encode(array('message' => 'Subject cannot be empty', 'code' => 0));
exit();

if ($message === '')
print json_encode(array('message' => 'Message cannot be empty', 'code' => 0));
exit();

$content="From: $name nEmail: $email nMessage: $message";
$recipient = "enquiries@rockclick.co.uk";
$mailheader = "From: $email rn";
mail($recipient, $subject, $content, $mailheader) or die("Error!");
print json_encode(array('message' => 'Email successfully sent!', 'code' => 1));
exit();
?></script>









share|improve this question














I've set up an email form on my site, added the php file, but it won't send the form to my email address. I contacted my webhost and they replied with "You would need to use a script which supports SMTP for sending not sendmail() which is what the current script is using". What does this mean? Have I set up my php file wrong? I've included my php file below. The form is currently hosted here http://www.rockclick.co.uk/contact.htm



<script><?php
$name = $_POST['name'];
$email = $_POST['email'];
$message = $_POST['message'];
$subject = $_POST['subject'];
header('Content-Type: application/json');
if ($name === '')
print json_encode(array('message' => 'Name cannot be empty', 'code' => 0));
exit();

if ($email === '')
print json_encode(array('message' => 'Email cannot be empty', 'code' => 0));
exit();
else
if (!filter_var($email, FILTER_VALIDATE_EMAIL))
print json_encode(array('message' => 'Email format invalid.', 'code' => 0));
exit();


if ($subject === '')
print json_encode(array('message' => 'Subject cannot be empty', 'code' => 0));
exit();

if ($message === '')
print json_encode(array('message' => 'Message cannot be empty', 'code' => 0));
exit();

$content="From: $name nEmail: $email nMessage: $message";
$recipient = "enquiries@rockclick.co.uk";
$mailheader = "From: $email rn";
mail($recipient, $subject, $content, $mailheader) or die("Error!");
print json_encode(array('message' => 'Email successfully sent!', 'code' => 1));
exit();
?></script>






php smtp contact-form






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Mar 25 at 15:44









Jo TidmanJo Tidman

114 bronze badges




114 bronze badges












  • why use the script tags for php?

    – pr1nc3
    Mar 25 at 15:47











  • I thought I had to?

    – Jo Tidman
    Mar 25 at 15:48











  • OK I removed the <script> tags but it's still not working!

    – Jo Tidman
    Mar 25 at 15:51











  • You would need to use a script which supports SMTP for sending not sendmail() which is what the current script is using they already told you what the problem is. the mail functions uses the tool sendmail by default. I'd recommend to use some library for email stuff; e.g. PHPMailer

    – kuh-chan
    Mar 25 at 15:54











  • Added an answer to your question. If my explanation is not clear please attach your code that you actually pass the values to the backend so i can explain further.

    – pr1nc3
    Mar 25 at 15:56

















  • why use the script tags for php?

    – pr1nc3
    Mar 25 at 15:47











  • I thought I had to?

    – Jo Tidman
    Mar 25 at 15:48











  • OK I removed the <script> tags but it's still not working!

    – Jo Tidman
    Mar 25 at 15:51











  • You would need to use a script which supports SMTP for sending not sendmail() which is what the current script is using they already told you what the problem is. the mail functions uses the tool sendmail by default. I'd recommend to use some library for email stuff; e.g. PHPMailer

    – kuh-chan
    Mar 25 at 15:54











  • Added an answer to your question. If my explanation is not clear please attach your code that you actually pass the values to the backend so i can explain further.

    – pr1nc3
    Mar 25 at 15:56
















why use the script tags for php?

– pr1nc3
Mar 25 at 15:47





why use the script tags for php?

– pr1nc3
Mar 25 at 15:47













I thought I had to?

– Jo Tidman
Mar 25 at 15:48





I thought I had to?

– Jo Tidman
Mar 25 at 15:48













OK I removed the <script> tags but it's still not working!

– Jo Tidman
Mar 25 at 15:51





OK I removed the <script> tags but it's still not working!

– Jo Tidman
Mar 25 at 15:51













You would need to use a script which supports SMTP for sending not sendmail() which is what the current script is using they already told you what the problem is. the mail functions uses the tool sendmail by default. I'd recommend to use some library for email stuff; e.g. PHPMailer

– kuh-chan
Mar 25 at 15:54





You would need to use a script which supports SMTP for sending not sendmail() which is what the current script is using they already told you what the problem is. the mail functions uses the tool sendmail by default. I'd recommend to use some library for email stuff; e.g. PHPMailer

– kuh-chan
Mar 25 at 15:54













Added an answer to your question. If my explanation is not clear please attach your code that you actually pass the values to the backend so i can explain further.

– pr1nc3
Mar 25 at 15:56





Added an answer to your question. If my explanation is not clear please attach your code that you actually pass the values to the backend so i can explain further.

– pr1nc3
Mar 25 at 15:56










1 Answer
1






active

oldest

votes


















0














I wasn't able to get this to work in the end so gave up and removed the form completely. It appears my web hosting doesn't support email forms.
If anyone has a working email form which sends an email to a gmail address then please feel free to post it here! I googled and have literally spent all day on it and it's beaten me.






share|improve this answer






















    Your Answer






    StackExchange.ifUsing("editor", function ()
    StackExchange.using("externalEditor", function ()
    StackExchange.using("snippets", function ()
    StackExchange.snippets.init();
    );
    );
    , "code-snippets");

    StackExchange.ready(function()
    var channelOptions =
    tags: "".split(" "),
    id: "1"
    ;
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function()
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled)
    StackExchange.using("snippets", function()
    createEditor();
    );

    else
    createEditor();

    );

    function createEditor()
    StackExchange.prepareEditor(
    heartbeatType: 'answer',
    autoActivateHeartbeat: false,
    convertImagesToLinks: true,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: 10,
    bindNavPrevention: true,
    postfix: "",
    imageUploader:
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    ,
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    );



    );













    draft saved

    draft discarded


















    StackExchange.ready(
    function ()
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55341550%2fcontact-form-php-file-not-set-properly-for-smtp-email-and-not-sending%23new-answer', 'question_page');

    );

    Post as a guest















    Required, but never shown

























    1 Answer
    1






    active

    oldest

    votes








    1 Answer
    1






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    0














    I wasn't able to get this to work in the end so gave up and removed the form completely. It appears my web hosting doesn't support email forms.
    If anyone has a working email form which sends an email to a gmail address then please feel free to post it here! I googled and have literally spent all day on it and it's beaten me.






    share|improve this answer



























      0














      I wasn't able to get this to work in the end so gave up and removed the form completely. It appears my web hosting doesn't support email forms.
      If anyone has a working email form which sends an email to a gmail address then please feel free to post it here! I googled and have literally spent all day on it and it's beaten me.






      share|improve this answer

























        0












        0








        0







        I wasn't able to get this to work in the end so gave up and removed the form completely. It appears my web hosting doesn't support email forms.
        If anyone has a working email form which sends an email to a gmail address then please feel free to post it here! I googled and have literally spent all day on it and it's beaten me.






        share|improve this answer













        I wasn't able to get this to work in the end so gave up and removed the form completely. It appears my web hosting doesn't support email forms.
        If anyone has a working email form which sends an email to a gmail address then please feel free to post it here! I googled and have literally spent all day on it and it's beaten me.







        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Mar 25 at 19:36









        Jo TidmanJo Tidman

        114 bronze badges




        114 bronze badges
















            Got a question that you can’t ask on public Stack Overflow? Learn more about sharing private information with Stack Overflow for Teams.







            Got a question that you can’t ask on public Stack Overflow? Learn more about sharing private information with Stack Overflow for Teams.



















            draft saved

            draft discarded
















































            Thanks for contributing an answer to Stack Overflow!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid


            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.

            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55341550%2fcontact-form-php-file-not-set-properly-for-smtp-email-and-not-sending%23new-answer', 'question_page');

            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            Kamusi Yaliyomo Aina za kamusi | Muundo wa kamusi | Faida za kamusi | Dhima ya picha katika kamusi | Marejeo | Tazama pia | Viungo vya nje | UrambazajiKuhusu kamusiGo-SwahiliWiki-KamusiKamusi ya Kiswahili na Kiingerezakuihariri na kuongeza habari

            SQL error code 1064 with creating Laravel foreign keysForeign key constraints: When to use ON UPDATE and ON DELETEDropping column with foreign key Laravel error: General error: 1025 Error on renameLaravel SQL Can't create tableLaravel Migration foreign key errorLaravel php artisan migrate:refresh giving a syntax errorSQLSTATE[42S01]: Base table or view already exists or Base table or view already exists: 1050 Tableerror in migrating laravel file to xampp serverSyntax error or access violation: 1064:syntax to use near 'unsigned not null, modelName varchar(191) not null, title varchar(191) not nLaravel cannot create new table field in mysqlLaravel 5.7:Last migration creates table but is not registered in the migration table

            은진 송씨 목차 역사 본관 분파 인물 조선 왕실과의 인척 관계 집성촌 항렬자 인구 같이 보기 각주 둘러보기 메뉴은진 송씨세종실록 149권, 지리지 충청도 공주목 은진현