Re: Prob with Send mail using mail()
| From: | Andy Hoffman | Date: | Tue, 17 Oct 2000 20:23:38 +0000 |
| Subject: | Re: Prob with Send mail using mail() | ||
| References: | 1 2 3 4 5 | Groups: | php.windows |
| Request: | Send a blank email to php-windows+get-3315@lists.php.net to get a copy of this message | ||
Mian Shafiq-Ur-Rehman wrote:
> <?
> $email ="msrehman@mail.com";
> $subject="Hai Dear Friend";
> $message="Testing PHP mail";
> $headers=" ";
> mail($email ,$subject,$message,$headers)
> ?>
First, it is not necessary to send a BLANK headers string in your call to
the mail function... simply call it like this:
mail($email, $subject, $message);
Also, note that you left off the final ";" (semi-colon) on the line which
calls the mail function... just check to make sure the line is terminated
with a semi-colon in your script.
> AND the settings in php.ini are
>
> SMTP = leo
> sendmail_from = me@localhost.com
OK, there are 2 scenarios you can use when accessing your SMTP server...
1) you have the SMTP server installed on the SAME computer as your running
web server
-or-
2) you have the SMTP server running on another computer/server, to which you
have DIRECT IP access (via DNS naming, or static IP addressing) - for the
sake of our example, I'll say the SMTP server is on "mysmtp.mydomain.com" or
IP address "123.123.123.123". Here's what your PHP.INI lines should look
like in either of these cases...
For Example 1 - SMTP on same computer as Web Server -
SMTP = localhost
sendmail_from = myusername@localhost
For Example 2 - SMTP on differenct computer -
SMTP = mysmtp.mydomain.com
sendmail_from = myusername@mydomain.com
- or -
SMTP = 123.123.123.123
sendmail_from = myusername@123.123.123.123
So, depending on your setup of the web server and it's access to the SMTP
server, you'll use one of these examples, substituting the correct values
for "myusername", "mydomain", etc.
That help at all?
--
Andy Hoffman
Web Developer
Bristol-Myers Squibb
email: andy.hoffman@bms.com