mail function is not working properly???

Reply

Join Date: Feb 2009
Posts: 130
Reputation: gagan22 is an unknown quantity at this point 
Solved Threads: 0
gagan22 gagan22 is offline Offline
Junior Poster

mail function is not working properly???

 
0
  #1
May 14th, 2009
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
Reply With Quote Quick reply to this message  
Join Date: Oct 2006
Posts: 1,010
Reputation: ardav will become famous soon enough ardav will become famous soon enough 
Solved Threads: 130
ardav's Avatar
ardav ardav is offline Offline
Veteran Poster

Re: mail function is not working properly???

 
0
  #2
May 14th, 2009
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.
Dunna letta dem afool ya - duh reppa sistema is da evil. INDETERMINACY is alive anda wella - force a duh issue.
Reply With Quote Quick reply to this message  
Join Date: Feb 2009
Posts: 130
Reputation: gagan22 is an unknown quantity at this point 
Solved Threads: 0
gagan22 gagan22 is offline Offline
Junior Poster

Re: mail function is not working properly???

 
0
  #3
May 15th, 2009
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.
Reply With Quote Quick reply to this message  
Join Date: Apr 2009
Posts: 37
Reputation: shefeekj has a little shameless behaviour in the past 
Solved Threads: 2
shefeekj shefeekj is offline Offline
Light Poster

Re: mail function is not working properly???

 
0
  #4
May 15th, 2009
try this code
  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.
Reply With Quote Quick reply to this message  
Join Date: Feb 2009
Posts: 130
Reputation: gagan22 is an unknown quantity at this point 
Solved Threads: 0
gagan22 gagan22 is offline Offline
Junior Poster

Re: mail function is not working properly???

 
0
  #5
May 15th, 2009
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
Reply With Quote Quick reply to this message  
Join Date: Feb 2009
Posts: 130
Reputation: gagan22 is an unknown quantity at this point 
Solved Threads: 0
gagan22 gagan22 is offline Offline
Junior Poster

Re: mail function is not working properly???

 
0
  #6
May 15th, 2009
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.
Reply With Quote Quick reply to this message  
Join Date: Nov 2007
Posts: 107
Reputation: kings has a little shameless behaviour in the past 
Solved Threads: 2
kings's Avatar
kings kings is offline Offline
Junior Poster

Re: mail function is not working properly???

 
0
  #7
May 15th, 2009
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 />";

			}

		}

?>
Reply With Quote Quick reply to this message  
Join Date: Feb 2009
Posts: 130
Reputation: gagan22 is an unknown quantity at this point 
Solved Threads: 0
gagan22 gagan22 is offline Offline
Junior Poster

Re: mail function is not working properly???

 
0
  #8
May 15th, 2009
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
Reply With Quote Quick reply to this message  
Join Date: Oct 2006
Posts: 1,010
Reputation: ardav will become famous soon enough ardav will become famous soon enough 
Solved Threads: 130
ardav's Avatar
ardav ardav is offline Offline
Veteran Poster

Re: mail function is not working properly???

 
0
  #9
May 16th, 2009
Have you tried commenting out your original code and replacing it with a hard-coded version?

  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?
Dunna letta dem afool ya - duh reppa sistema is da evil. INDETERMINACY is alive anda wella - force a duh issue.
Reply With Quote Quick reply to this message  
Join Date: Feb 2009
Posts: 130
Reputation: gagan22 is an unknown quantity at this point 
Solved Threads: 0
gagan22 gagan22 is offline Offline
Junior Poster

Re: mail function is not working properly???

 
0
  #10
May 16th, 2009
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
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC