Jump to content

PHP mail(), mail dont send.


Nati323
 Share

Recommended Posts

hey, i have a problem , i try to send email vie php mail() function, and the mail dosent get to my mail acount, the function return true, but the mail dosent came to my inbox or spam boxes on my mail, my code:

if (!mail($_POST['mail'], $text['EMAIL_RECOVER_MSG_SUBJECT'], $text['EMAIL_RECOVER_MSG'], $from)) {							$msg = $text['MAIL_ERROR'];							$msgDisplay = 'inline';						}						else {							$recover = false;							echo "<div class='alert alert-success'> {$text['RECOVER_MAIL_SENT']}</div>";						}

the code show that all run good and the function return true, example for information that i try to send:

nati323@gmail.comPassword Recover: From dmworld24.comYou Forget Your Password To Recover it Please Go Into The Next Link:rn http://dmworld24.com/login.php?act=rec&token=44524977019863526261982473991 rn If You Didnt Ask For Password Recovering Just Ignore This MessageFrom: system@dmworld24.com

the first line is to, second subject, three msg, four: from header

 

i'm usins xampp, so maybe somthing need to be installled.. ??

Edited by Nati323
Link to comment
Share on other sites

i also check on some server , not on my xampp, and its still dosent send, i try to copy the mail send code from php.net, and still no result,

 

please someone i very need this thing work for me...

Edited by Nati323
Link to comment
Share on other sites

Trying to send email from a home computer can be problematic. If you don't have a mail server installed on your web server, that's one problem. I'm not sure how XAMPP comes configured, but there's some information here:http://stackoverflow.com/questions/15965376/how-to-configure-xampp-to-send-mail-from-localhostAlso, your home ISP might be blocking email from being sent. If that's the case then you can't send email from your own server, your code will need to connect to another mail server like Gmail and use that to send email. You can do that by using SMTP to send email.

Link to comment
Share on other sites

i define every thing like they say there but still it dosent work,

 

i also tried to send mail vie some hosting that have sendmail and still dosent work.

 

at the end i use PHPmailer with connect to Gmail SMTP server, but still i want to know why its didnt work for me...

Link to comment
Share on other sites

a) i try to sent to another mail address and its didnt work to.

B) with PHPMailer this mail send good.

c) i read in stackoverflow about what you say and i did all they say there, still not work.

d) You or another pepole trying my code, and i get mails

Link to comment
Share on other sites

i use PHPMailer with gmail SMTP, the code:

	$mail = new PHPMailer(true);	$mail->Mailer       = "smtp";	$mail->IsSMTP();  // telling the class to use SMTP	$mail->SMTPDebug    = 0; 	$mail->SMTPSecure = 'tls';	$mail->Host     = "smtp.gmail.com"; // SMTP server	$mail->Username   = "nati323@gmail.com";	$mail->Password   = "******";	$mail->addCustomHeader('Content-Type: text/plain; charset="utf-8"');	$mail->SMTPAuth   = true;       	$mail->Port       = 587;	$mail->From     = $from;	$mail->AddAddress($to);	$mail->Subject  = $subject;	$mail->Body     = $msg;	return $mail->Send();

i dont know what is isp...

Link to comment
Share on other sites

The ISP is what gives you internet service at your house. If it works to connect to a remote mail server using SMTP, but you cannot send email from your own server, then it sounds like your ISP is blocking that. ISPs will sometimes block outgoing email for home internet accounts and require a business account to enable outgoing email.

Link to comment
Share on other sites

The code you posted in the first post is going to do what it claims to do, it's going to deliver a message to the mail transfer agent (sendmail), and the MTA is going to attempt to deliver it to the remote mail server. If the MTA accepts the email for sending then the mail function in PHP will return true. In practice, there are several reasons why mail servers would choose to not accept the email. Maybe the mail server trying to send the mail is not associated with the domain in the from address, and the receiving mail server will block the email because of that. Maybe the server is missing SPF records or other things that the receiving server requires. Maybe the IP address of the sending server is one a blacklist that the receiving server uses. Any of those might cause the receiving server to choose to not accept the message for delivery.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...