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<you@yoursite.com>\nX-Mailer: PHP/" . phpversion()) or die("Unable to send mail");
echo "Your email was sent successfuly";
?>
[/code]
Link to comment
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
Link to comment
Share on other sites

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.
Link to comment
Share on other sites

[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.
Link to comment
Share on other sites

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)
Link to comment
Share on other sites

[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.
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.