943,515 Members | Top Members by Rank

Ad:
  • PHP Discussion Thread
  • Unsolved
  • Views: 2220
  • PHP RSS
You are currently viewing page 1 of this multi-page discussion thread
May 14th, 2009
0

mail function is not working properly???

Expand Post »
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
Similar Threads
Reputation Points: 10
Solved Threads: 0
Junior Poster
gagan22 is offline Offline
131 posts
since Feb 2009
May 14th, 2009
0

Re: mail function is not working properly???

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.
Last edited by ardav; May 14th, 2009 at 4:39 pm.
Sponsor
Featured Poster
Reputation Points: 1041
Solved Threads: 941
Sarcastic Poster
ardav is offline Offline
6,661 posts
since Oct 2006
May 15th, 2009
0

Re: mail function is not working properly???

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
Last edited by gagan22; May 15th, 2009 at 2:31 am.
Reputation Points: 10
Solved Threads: 0
Junior Poster
gagan22 is offline Offline
131 posts
since Feb 2009
May 15th, 2009
0

Re: mail function is not working properly???

try this code
php Syntax (Toggle Plain Text)
  1. <!–p
  2. $subject = “Test mail”;
  3. $message = “Hello! This is a simple email message.”;
  4. $from = “someonelse@example.com”;
  5. $headers = “From: $from”;
  6. mail($to,$subject,$message,$headers);
  7. echoMail Sent.”;?>

or check out

<URL SNIPPED>
Last edited by peter_budo; May 15th, 2009 at 7:31 am. Reason: Keep It Spam Free - Do not spam, advertise, plug your website, or engage in any other type of self promotion.
Reputation Points: 1
Solved Threads: 2
Light Poster
shefeekj is offline Offline
37 posts
since Apr 2009
May 15th, 2009
0

Re: mail function is not working properly???

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
Reputation Points: 10
Solved Threads: 0
Junior Poster
gagan22 is offline Offline
131 posts
since Feb 2009
May 15th, 2009
0

Re: mail function is not working properly???

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,
Last edited by gagan22; May 15th, 2009 at 7:36 am.
Reputation Points: 10
Solved Threads: 0
Junior Poster
gagan22 is offline Offline
131 posts
since Feb 2009
May 15th, 2009
0

Re: mail function is not working properly???

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 />";

			}

		}

?>
Reputation Points: 3
Solved Threads: 2
Junior Poster
kings is offline Offline
107 posts
since Nov 2007
May 15th, 2009
0

Re: mail function is not working properly???

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
Reputation Points: 10
Solved Threads: 0
Junior Poster
gagan22 is offline Offline
131 posts
since Feb 2009
May 16th, 2009
0

Re: mail function is not working properly???

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

PHP Syntax (Toggle Plain Text)
  1. $sendmail = mail('nobody@yoursite.com', 'hello', 'hello world this is a message', 'From: webmaster@example.com' . "\r\n" .
  2. 'Reply-To: webmaster@mysite.com' . "\r\n" .
  3. 'X-Mailer: PHP/' . phpversion());
does this work?
Sponsor
Featured Poster
Reputation Points: 1041
Solved Threads: 941
Sarcastic Poster
ardav is offline Offline
6,661 posts
since Oct 2006
May 16th, 2009
0

Re: mail function is not working properly???

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
Reputation Points: 10
Solved Threads: 0
Junior Poster
gagan22 is offline Offline
131 posts
since Feb 2009

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in PHP Forum Timeline: show color on table if a user select a seat?
Next Thread in PHP Forum Timeline: My little php problem





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC