Hi everyone,

I am using a mail function in my contactus form. But for some id it is sending infromation of contac us form but some time it is not sending like on my gmail id i am not getting mail.

what is the reason behind this. I have tried every efforts.

I am using this code for mail function :- mail($mailto, $subject, $messageproper,"From: \"$fname\" <$email>" . $headersep . "Reply-To: \"$fname\" <$email>" . $headersep . "X-Mailer: chfeedback.php 2.07" ); in this when $mailto='myid@gmail.com';
i am using this is not working means i am not getting mail form contact us page.

Please help me . How i can solve this .

thanks,
gagan

Recommended Answers

All 12 Replies

Member Avatar for diafol

Are you supplying a return e-mail registered to that domain? If not, some hosts block the mail, e.g. if your domain is www.example.com and your return address is me@jackspit.net, then the host may block it. They try to discourage spammers and jackers.

hi,
Thanks for reply,

Sorry i am not understand about return email address about registered. So please explain me in brief. I have done every effort to solve this problem Still i am getting no mail from contact us form .

Please help me if there is any other mail function in PHP which i can use and which can solve my problem.
It is very urgent for me because my client is not getting mail and he is frustrating.

thanks

try this code

<!–p
$subject = “Test mail”;
$message = “Hello! This is a simple email message.”;
$from = “someonelse@example.com”;
$headers = “From: $from”;
mail($to,$subject,$message,$headers);
echo “Mail Sent.”;?>

or check out

<URL SNIPPED>

hi,
I have tried this code . I am getting mail first time on my id after uploading this page . but after that when i fill contact us form 2nd time or 3rd time then mail is not coming on my id.

What can be the problem ??. I am not understanding. I am ubavke to find this problem. Please help me.
Thanks

Hi everyone,

I am facing problem in mailer.php file. In this i am not getting mail from contact us form . Please help me . How i can solve this problem.

I am sending the code of mailer.php file . Please check this code. If you have any suggestions about changing this code. Then pls suggest me.
The code for mailer.php file is :

<?php

$thankyouurl = "http://www.mysite.com/ThankYou.html" ;
$to = 'myemail-id@gmail.com' ;
$subject = "Quick Contact Form";


 $name = $_POST['fname'] ;

$email = $_POST['email'] ;

$comments = $_POST['message'] ;

$cname = $_POST['cname'] ;

$add = $_POST['add'] ;

$telephone = $_POST['tnumber'] ;

$webadd = $_POST['webadd'] ;


$message =

 

        "This message was sent from:\n" .

        "$http_referrer\n" .

        "------------------------------------------------------------\n" .

        "Name of sender: $name\n" .

        "Email of sender: $email\n" .
		
        "Company Name  of sender: $cname\n" .
		
        "Address  of sender: $add\n" .
		
        "Telephone  Number of sender: $telephone\n" ;
		
		
		

       

 
 $headers = "MIME-Version: 1.0\r\n";
$headers .= "Content-type: text/html; charset=iso-8859-1\r\n";
    $headers . = "From: $email"."\r\n";
	
mail($to,$subject,$message,$headers);

header( "Location: $thankyouurl" );

?>

After submitting form it is going on thanks page but mail is not going on my email id .

What can be solution for this. Please help me.
Thanks,

hi the below works for gmail also

<?
		$body.="<html><body><span>";

		$body.="<br /><bHi GOD BLESS U</b><br />";

		$body.="</span></body></html>";

		$from=";//mail id

		$replyto=$from;

		$to="";//mail id

		$toarr = explode(",",$to);

		$headers = "MIME-Version: 1.0\r\n";

		$headers .= "Content-Type: text/html; charset=iso-8859-1" . "\r\n";

		if (strlen($body)>998) {

			$headers .= "Content-Transfer-Encoding: base64;" . "\r\n";

			$body=rtrim(chunk_split(base64_encode($body)));

		} 

		$headers .= 'From: ' . $from . "\r\n" .

			'Reply-To: ' . $replyto . "\r\n" .

			'X-Mailer: PHP/' . phpversion();		

		foreach($toarr as $key => $value){

			if (strlen($value) > 0) {

				if (mail($value, $sub, $body, $headers)) {

					$mailsentto .= "Mail sent to : ".$value."<br />";

				} else $mailsentto .= "Error when sending Mail to ".$value."<br />";

			}

		}

?>

hi,

Thanks for reply,

I have used this code in my mailer.php file. But when i am printing value $mailsentto.


Then this is showing this output:

Error when sending Mail to myid@gmail.com

I do not know why this is going. Why mail is not going on mail id.

Please help me to solve this issue.
Thanks

Member Avatar for diafol

Have you tried commenting out your original code and replacing it with a hard-coded version?

$sendmail = mail('nobody@yoursite.com', 'hello', 'hello world this is a message', 'From: webmaster@example.com' . "\r\n" .
    'Reply-To: webmaster@mysite.com' . "\r\n" .
    'X-Mailer: PHP/' . phpversion());

does this work?

thanks for reply,

yes i have tried like as you give me code. but after mail is not going.

I have put this mail function in many website. But i am not getting where the problem is coming.

But it seeming this problem can be from server or hosting side. If yes, Please suggest me . What Problem can be from server or our hosting site. So I can tell them that where is the problem.

Thanks
gagan

Member Avatar for diafol

Like I mentioned in the first post, it's possible that your host has a block on mail() without a registered email to the hosted domain. Eg. I have a few accounts on Streamline.net and this is their policy:

Streamlinenet filters all outgoing e-mail. These must have a 'From' or 'To' address that is a domain hosted with Streamlinenet. Any e-mail not fulfilling these criteria is stopped.

If you are sending e-mail to a customer who has given you their e-mail address, you need to use the domain name of their site (but it does not need to be a valid mailbox, for example noreply@their-domain.co.uk is a fairly common one to use). If you want the customer to reply to the e-mail you must use a valid account.

Streamlinenet's SMTP Filter System limits the outgoing mail from a domain to prevent bulk e-mailing. The limits are set to allow normal form based e-mail activity to pass unhindered, but stop any persistent attempt to send bulk mail.

Check with your host if they have a similar policy.

thanks for reply,

I will chat with my hosting site . I was also thinking that problem is not our side this problem is due to server or hosting site.

I will contact them soon. But it will take 3 to 4 days. After that i will contact on this post through my reply.

Ok sir thanks for giving so much help.

Off-topic for ardav - If you post by mistake, just click on "Flag Bad Post" and type reason like "Double post", "Post by mistake" and one of the moderators will take care of it

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.