Gruzin Posted August 25, 2006 Share Posted August 25, 2006 hi guys I'am trying to write a simple php mail script, but it doesn't actually send the mail... I don't know, maybe someone will explain it to me. Thanks for your time. Here is the code:[code]<?php$to = $_POST['mail'];$subject = $_POST['sub'];$message = $_POST['mes'];$to = stripslashes($to);$subject = stripslashes($subject);$message = stripslashes($message);mail($to, $subject, $message, "From: You<you@yoursite.com>\nX-Mailer: PHP/" . phpversion()) or die("Unable to send mail"); echo "Your email was sent successfuly";?>[/code] Quote Link to comment Share on other sites More sharing options...
HuggieBear Posted August 25, 2006 Share Posted August 25, 2006 The mail() function within PHP relies on the PHP install knowing where sendmail is on your system at compile time.If you use phpinfo() to get information about your install and then look for the values [b]sendmail_from[/b] and [b]sendmail_path[/b] under the 'PHP Core' information.If these values are propgated then you're off to a good start.RegardsRich Quote Link to comment Share on other sites More sharing options...
Gruzin Posted August 25, 2006 Author Share Posted August 25, 2006 I've done it, here it is:[color=red]sendmail_from me@localhost.com me@localhost.com sendmail_path /bin/sendmail -t -i -f'postmaster@3d.caucasus.net' /bin/sendmail -t -i -f'CN_Webhosting' [/color] so whats the problem? thanks for your answer. Quote Link to comment Share on other sites More sharing options...
HuggieBear Posted August 25, 2006 Share Posted August 25, 2006 Bad news is I've tried this code and it works fine, as expected.So maybe your problem is with the PHP/Sendmail setup somewhere. Do you know enough about sendmail to send yourself a test using sendmail to check that it's working?Rich Quote Link to comment Share on other sites More sharing options...
Gruzin Posted August 25, 2006 Author Share Posted August 25, 2006 [quote author=HuggieBear link=topic=105588.msg421849#msg421849 date=1156500482]Bad news is I've tried this code and it works fine, as expected.So maybe your problem is with the PHP/Sendmail setup somewhere. Do you know enough about sendmail to send yourself a test using sendmail to check that it's working?Rich[/quote]unfortunately no, if it won't take your time, can u tell me how to do that? thanks a lot. Quote Link to comment Share on other sites More sharing options...
ronverdonk Posted August 25, 2006 Share Posted August 25, 2006 When you are using Windows, the following must be defined in your PHP.INI[code]; For Win32 only.SMTP = mail.yourprovider.xxsmtp_port = 25; For Win32 only.sendmail_from = your_emailid@your_provider.xx[/code]You SMTP must define your real mail provider and not localhost.xxx unless you run a mailserver yourself.Ronald 8) Quote Link to comment Share on other sites More sharing options...
lessthanthree Posted August 25, 2006 Share Posted August 25, 2006 [quote author=ronverdonk link=topic=105588.msg421853#msg421853 date=1156500826]When you are using Windows, the following must be defined in your PHP.INI[code]; For Win32 only.SMTP = mail.yourprovider.xxsmtp_port = 25; For Win32 only.sendmail_from = your_emailid@your_provider.xx[/code]You SMTP must define your real mail provider and not localhost.xxx unless you run a mailserver yourself.Ronald 8)[/quote]I don't think he's running a windows server. Quote Link to comment Share on other sites More sharing options...
Gruzin Posted August 25, 2006 Author Share Posted August 25, 2006 yes lessthanthree you are right, I'am not using windows server... just provider hosting. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.