How to run contact us page in website ?

1 replies
i am trying to develp php website.. i do all the things. but when i upload site on hosting i dont understand how to i get mail from contact us form ? i am do this coding too in php. but i dont understand how to connect with hosting to get email from contact us page..?

This is a code which i create for run contact us page.but how to connect with email or hosting?
<?php
$name = @trim(stripslashes($_POST['name']));
$from = @trim(stripslashes($_POST['email']));
$subject = @trim(stripslashes($_POST['subject']));
$message = @trim(stripslashes($_POST['message']));
$to = 'info@connectdigitalworld.tk';//replace with your email

$headers = array();
$headers[] = "MIME-Version: 1.0";
$headers[] = "Content-type: text/plain; charset=iso-8859-1";
$headers[] = "From: {$name} <{$from}>";
$headers[] = "Reply-To: <{$from}>";
$headers[] = "Subject: {$subject}";
$headers[] = "X-Mailer: PHP/".phpversion();

mail($to, $subject, $message, $headers);

die;
#contact #page #run #website
  • Profile picture of the author affplugs
    Actually, that function, as it is, should send an email to the "To" email id if the required data are present.

    print_r(error_get_last()) will fetch the error if mail() returns false.

    [type] => 2
    [message] => mail(): Failed to connect to mailserver....
    [file] => C:\www\mailfunc.php
    [line] => 2
    {{ DiscussionBoard.errors[11011463].message }}

Trending Topics