Jump to content

Little help needed with php mail


Gruzin

Recommended Posts

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<[email protected]>\nX-Mailer: PHP/" . phpversion()) or die("Unable to send mail");
echo "Your email was sent successfuly";
?>
[/code]
Link to comment
https://forums.phpfreaks.com/topic/18630-little-help-needed-with-php-mail/
Share on other sites

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.

Regards
Rich
[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.
When you are using Windows, the following must be defined in your PHP.INI

[code]
; For Win32 only.
SMTP = mail.yourprovider.xx
smtp_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 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.xx
smtp_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.

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.