Jump to content

[SOLVED] not recieving email from mail()


garydt

Recommended Posts

I've got a mail script, i'm not getting errors but i'm not getting emails either.

$username = $row_Recordset4['usernm'];
$from = 'test@uk.com';
$to = 'gary@garyt.co.uk';
$body = "test";

$headers = "From: info@example.com \r\n"; 
$headers.= "Content-Type: text/html; charset=ISO-8859-1 "; 
$headers .= "MIME-Version: 1.0 "; 

mail($to, "An HTML Message", $body, $headers);

 

php.ini file-

[mail function]

; For Win32 only.

;SMTP = smtp.tiscali.co.uk

;smtp_port = 25

 

; For Win32 only.

sendmail_from = me@localhost.com

sendmail_path = C:\Program Files\xampp\sendmail

pop3_server= pop.tiscali.co.uk

pop3_username= garydt88

pop3_password= garytanner

 

 

 

Link to comment
Share on other sites

"Returns TRUE if the mail was successfully accepted for delivery, FALSE otherwise.

 

"It is important to note that just because the mail was accepted for delivery, it does NOT mean the mail will actually reach the intended destination. "

 

From http://in2.php.net/manual/en/function.mail.php

Link to comment
Share on other sites

That's exactly is what the manual says, although it is not faulty. I don't know how this works on Windoze. In my experience I have learned that it is safe and reliable if you use a PHP script that connects and authenticates to the SMTP server to send mails.

 

Link to comment
Share on other sites

I'm still having trouble.
[cod]$from = 'test@uk.com';
$to = "gary@garyt.co.uk";
$body = "test";

$headers = "From: info@example.com \r\n"; 
$headers.= "Content-Type: text/html; charset=ISO-8859-1 "; 
$headers .= "MIME-Version: 1.0 "; 

if (mail($to, "An HTML Message", $body, $headers)){

//if sent tell them.
echo"Your email was sent to $to";

}else{

//if not sent tell them.
echo"Sorry no email sent please try agin.";
}

When i try it i get the message saying it was sent but i still get no email.

 

I've downloaded zend but i don't know how to use it, it has no instructions.

 

I thought sending emails in php was supposed to  be easy.

 

Please help.

Link to comment
Share on other sites

try this ok.

 

<?php

// To who ever.
$to = 'xxxxxxxx@xxxxxxx.xxxxx';

//from you the sender.
$from='xxxxxxxx@xxxxxx.xxxx';

//Subject line what ever.
$subject = 'hi mate it me aging how\'s you!';

$mess='<html><head><title>my good message for you mate</title>
       <body> <h1> redarrow look at this good web site unreel <p></p>
       <a href="http://www.google.com">Go there Know it unreel mate</a></h1><p></p>
       </body></html>';

$message = $mess;



$headers = "From: $from\r\n" .
        'X-Mailer: PHP/' . phpversion() . "\r\n" .
        "MIME-Version: 1.0\r\n" .
        "Content-Type: text/html; charset=utf-8\r\n" .
        "Content-Transfer-Encoding: 8bit\r\n\r\n";

// send if correct.
if(mail($to, $subject, $message, $headers)){

//if sent tell them.
echo"Your email was sent to $to";

}else{

//if not sent tell them.
echo"Sorry no email sent please try agin.";
}

?>

Link to comment
Share on other sites

If you use Zigmoyd Mailer It will Work and send the mails.

If it fails it will display you why It failed if there is a Problem in SMTP server It will also Display you that and Its simpler than that Of mail().

And generally All mails Goes To INBOX NOT in Spam or Junk.

$mail = new mail("to@localhost", "Subject", "Mail Body");
if($mail->send())
  {
    echo "Mail Sent Successfully\n";
  }
else
  {
    echo "Sorry Mail Sending Failed\n";
    print_r($mail->error);//Print The Errors
  }

See the class at http://zigmoyd.sourceforge.net/man/mail.php#mail

Installation and Instruction at http://zigmoyd.sourceforge.net/man/index.php

Edit the setup_mail.php (in teh mail Folder) accordingly.In real life Situation you may not be able to edit php.ini file. Then also you can use it.

It will also Sho you how does a mail Goes

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.