Jump to content

Email Sending Problem


kmk4

Recommended Posts

hi every one i had strange problem i cant send email via my site i tried this code
[code]
<?php
$to      = 'myemail@example.com';
$subject = 'test email';
$message = 'hello';
$headers = 'From: webmaster@example.com' . "\r\n" .
    'Reply-To: webmaster@example.com' . "\r\n" .
    'X-Mailer: PHP/' . phpversion();

mail($to, $subject, $message, $headers);
?>
[/code]
i make a php file with this code only and i run it it didn't send email
i chick for sendmail path in the phpinfo.html it was correct
so what is possible wrong with this
thank u for reading my topic
Link to comment
Share on other sites

[quote] chick for sendmail path in the phpinfo.html it was correct[/quote]

If the php from did not spit out any errors then it is likley to be that your server is not set up to send mail correctly.  One common resion for this is that the server can not resolve address propaly?  Have you specified DNS server?

In the comand line try to ping something like www.phpfreaks.com and see weather it resolves them?  - Let us know.

Can you try running the folowing code insted:
[code]
$success = mail("you@whatwhatever.com", "testmail", "somecontent", "From: <jim@jim.com>");

if ($success)
{
  print "Sent fine";
}
else
{
print "Not working";
}[/code]

Works on mine so im hoping it might on yours!

Lastly try these to things:
check sendmail is running: something like: service sendmail status (not sure what OS your running
And post the last fiew lines of your send mail log.  somthing like
nano /var/log/maillog i guess.
Link to comment
Share on other sites

i used your code it send mail
i tried mine again it works but after i changed my email i think the problem was the site was sending email to my hotmail account and the hotmail auto delete it i chicked junk mail there is nothing there but it works fine with gmail and yahoo i tried them both

problem solved

thanks for every one that help me to solve my problem
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.