This is a discussion on newbie: mail daemon for php on WinXP within the alt.comp.lang.php forums, part of the PHP Programming Forums category; Hey I'm developing a web site using php 5.2.0. I'm developing the web site on my ...
|
|||||||
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
|
|||
|
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 |
|
|||
|
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 > > |
|
|||
|
Carl Pearson wrote:
> Put this just before your mail statement: > ini_set('sendmail_from', 'my_address@my_domain.com'); > (please don't top post) He'll also need to set the SMTP host and port in php.ini file (same as the outgoing/DMTP mail server in Outlook express - but note that AFAIK the stock PHP mail() function doesn't support authentication). > > 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. > I'd agree that Linux/*nox is a much nicer environment to admin / develop in - but you can get severely bitten setting up mail and web servers unless you have a fair amount of skill. C. |
|
|||
|
Jeff schreef:
> 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 > > Go to the homepage of wampserver and download the latest version. During install he will aks you some information to send mail. After wampserver is setup, everything works. -- Posting at the top because that's where the cursor happened to be, is like shitting in your pants because that's where your asshole happened to be. http://www.essetee.be |
|
|||
|
Jeff schreef:
> > This is my code sending the mail: > mail($email, "test av website", "helloworld"); > > mail("to","subject","message","From: your_valid_email_address"); -- Posting at the top because that's where the cursor happened to be, is like shitting in your pants because that's where your asshole happened to be. http://www.essetee.be |