|
Posted by Carl Pearson on 01/09/07 17:27
Put this just before your mail statement:
ini_set('sendmail_from', 'my_address@my_domain.com');
Set the from address to something within your domain, preferably a valid
email.
You can also use a var instead of hard coding the from address.
IIRC, many hosts require you to use this so that from the server's point
of view, the 'from' address is the same as the domain, otherwise their
mail server may reject it.
Running it locally you're probably using your ISP's SMTP connection, so
not sure why it should matter.
Then again, I'm not up on IIS, it's M$ so who knows what they're trying
to lock down.
Shameless suggestion, switch to Apache. Try XAMPP for starters. Sorry,
had to say it. You'll really get a leg up on how the majority of web
servers worldwide operate, and have an easier time maintaining any live
site that runs on *nix.
Jeff wrote:
> Hey
>
> I'm developing a web site using php 5.2.0. I'm developing the web site on my
> winXP computer. I use IIS as web server (that is a web server running on my
> pc, localhost).
>
> When new users registers to the web site, then I want the web site to send
> an email to the new user, but my mail method fails and give me an error
> message (see below)
>
> This is my code sending the mail:
> mail($email, "test av website", "helloworld");
>
> This is the error message I get:
> Warning: mail() [function.mail]: "sendmail_from" not set in php.ini or
> custom "From:" header missing in C:\Inetpub\wwwroot\demo\registration.php on
> line 24
>
> The problem must be related to the sendmail_from settings in php.ini:
> [mail function]
> SMTP = localhost
> smtp_port = 25
> sendmail_from = it_consultant1@hotmail.com
>
> Could the error be because I haven't configured a mail daemon on my pc? I
> haven't installed exchange or any other mail server program on my pc... But
> I have installed outlook express (i'm sending this email via outlook
> express). Maybe I could set SMTP to the SMTP address my ISP have given me.
> (with ISP I mean here the company that gives me internet access) But that
> will NOT be a SMTP on my pc, maybe that is wrong approach...
>
> I'm stucked here... I just want to test the mail sending functionality
> before I publish the web site.....
>
> Any suggestions?
>
> Jeff
>
>
Navigation:
[Reply to this message]
|