newbie: problem sending email from php web site

This is a discussion on newbie: problem sending email from php web site within the alt.comp.lang.php forums, part of the PHP Programming Forums category; Hey I'm developing a web site using php version 5.2.0. Users are offered to register at the ...


Go Back   Usenet Forums > PHP Programming Forums > alt.comp.lang.php

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 01-08-2007
Jeff
 
Posts: n/a
Default newbie: problem sending email from php web site

Hey

I'm developing a web site using php version 5.2.0. Users are offered to
register at the web site. To complete the registration the user will get an
email containg a link he need to use for to activate his account....

But sending email from my web site isn't working.
I get this error:
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 21

This is the code the errror message above is refering to:
mail($email, "test av website", "helloworld", "it_consultant1@hotmail.com");

my php.ini:
; For Win32 only.
sendmail_from = it_consultant1@hotmail.com

; For Unix only. You may supply arguments as well (default:
"sendmail -t -i").
;sendmail_path =

This is on a winXP computer, so I didn't set the sendmail_path (the php.ini
says sendmail_path is for unix only)

Any suggestions on what I should do to solve this?

Jeff


Reply With Quote
  #2 (permalink)  
Old 01-08-2007
Tyrone Slothrop
 
Posts: n/a
Default Re: newbie: problem sending email from php web site

On Mon, 8 Jan 2007 15:14:21 +0100, "Jeff"
<it_consultant1@hotmail.com.NOSPAM> wrote:

>Hey
>
>I'm developing a web site using php version 5.2.0. Users are offered to
>register at the web site. To complete the registration the user will get an
>email containg a link he need to use for to activate his account....
>
>But sending email from my web site isn't working.
>I get this error:
>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 21
>
>This is the code the errror message above is refering to:
>mail($email, "test av website", "helloworld", "it_consultant1@hotmail.com");
>
>my php.ini:
>; For Win32 only.
>sendmail_from = it_consultant1@hotmail.com
>
>; For Unix only. You may supply arguments as well (default:
>"sendmail -t -i").
>;sendmail_path =
>
>This is on a winXP computer, so I didn't set the sendmail_path (the php.ini
>says sendmail_path is for unix only)
>
>Any suggestions on what I should do to solve this?
>
>Jeff


I believe your problem is with the header that you are sending. The
format for the mail function is:
mail ($to, $subject, $text_body, $headers);

Headers must be formed in an acceptable format:
$headers = "From: someone@somedomain.com\nBcc: bcc@somedomain.com\n";
etc.

Reply With Quote
  #3 (permalink)  
Old 01-08-2007
Jeff
 
Posts: n/a
Default Re: newbie: problem sending email from php web site


"Tyrone Slothrop" <ts@paranoids.com> wrote in message
news:h0t4q2p9ptlr7lbvhl75plnk9jkdnsv199@4ax.com...
> On Mon, 8 Jan 2007 15:14:21 +0100, "Jeff"
> <it_consultant1@hotmail.com.NOSPAM> wrote:
>
>>Hey
>>
>>I'm developing a web site using php version 5.2.0. Users are offered to
>>register at the web site. To complete the registration the user will get
>>an
>>email containg a link he need to use for to activate his account....
>>
>>But sending email from my web site isn't working.
>>I get this error:
>>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 21
>>
>>This is the code the errror message above is refering to:
>>mail($email, "test av website", "helloworld",
>>"it_consultant1@hotmail.com");
>>
>>my php.ini:
>>; For Win32 only.
>>sendmail_from = it_consultant1@hotmail.com
>>
>>; For Unix only. You may supply arguments as well (default:
>>"sendmail -t -i").
>>;sendmail_path =
>>
>>This is on a winXP computer, so I didn't set the sendmail_path (the
>>php.ini
>>says sendmail_path is for unix only)
>>
>>Any suggestions on what I should do to solve this?
>>
>>Jeff

>
> I believe your problem is with the header that you are sending. The
> format for the mail function is:
> mail ($to, $subject, $text_body, $headers);
>
> Headers must be formed in an acceptable format:
> $headers = "From: someone@somedomain.com\nBcc: bcc@somedomain.com\n";
> etc.
>


Thanks, but now I get an new error:
Warning: mail() [function.mail]: SMTP server response: 501 5.5.4 Invalid
Address in

I'm sure the email addresses I use is valid

This is the code I use to send the email:
$headers = 'From: me <it_consultant1@hotmail.com>' . "\n";
mail($email, "test av website", "helloworld", $headers);

in php.ini I have SMTP = localhost

I haven't got microsoft exchange or similar mail program installed on my pc.
I have outlook express installed on my pc, so I use outlook express when
browsing newgroups and sending emails. So I thought if I could send email
via outlook express then maybe it's possible to send email from a web site
hosted on the same pc.

Any suggestions?

Jeff


Reply With Quote
  #4 (permalink)  
Old 01-08-2007
Jeff
 
Posts: n/a
Default Re: newbie: problem sending email from php web site


"Tyrone Slothrop" <ts@paranoids.com> wrote in message
news:h0t4q2p9ptlr7lbvhl75plnk9jkdnsv199@4ax.com...
> On Mon, 8 Jan 2007 15:14:21 +0100, "Jeff"
> <it_consultant1@hotmail.com.NOSPAM> wrote:
>
>>Hey
>>
>>I'm developing a web site using php version 5.2.0. Users are offered to
>>register at the web site. To complete the registration the user will get
>>an
>>email containg a link he need to use for to activate his account....
>>
>>But sending email from my web site isn't working.
>>I get this error:
>>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 21
>>
>>This is the code the errror message above is refering to:
>>mail($email, "test av website", "helloworld",
>>"it_consultant1@hotmail.com");
>>
>>my php.ini:
>>; For Win32 only.
>>sendmail_from = it_consultant1@hotmail.com
>>
>>; For Unix only. You may supply arguments as well (default:
>>"sendmail -t -i").
>>;sendmail_path =
>>
>>This is on a winXP computer, so I didn't set the sendmail_path (the
>>php.ini
>>says sendmail_path is for unix only)
>>
>>Any suggestions on what I should do to solve this?
>>
>>Jeff

>
> I believe your problem is with the header that you are sending. The
> format for the mail function is:
> mail ($to, $subject, $text_body, $headers);
>
> Headers must be formed in an acceptable format:
> $headers = "From: someone@somedomain.com\nBcc: bcc@somedomain.com\n";
> etc.
>


After re-reading the documentation about the mail function I realize that
the mail function don't need addional headers in order to work. I've read in
the documentation that mail() can accept only 3 parameters:
http://no.php.net/manual/en/function.mail.php

This is my code sending the mail:
mail($email, "test av website", "helloworld");

This is the error 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]
; For Win32 only.
SMTP = localhost
smtp_port = 25

; For Win32 only.
sendmail_from = it_consultant1@hotmail.com

Any suggestions?

Jeff


Reply With Quote
  #5 (permalink)  
Old 01-09-2007
Tyrone Slothrop
 
Posts: n/a
Default Re: newbie: problem sending email from php web site

>Thanks, but now I get an new error:
>Warning: mail() [function.mail]: SMTP server response: 501 5.5.4 Invalid
>Address in
>
>I'm sure the email addresses I use is valid
>
>This is the code I use to send the email:
>$headers = 'From: me <it_consultant1@hotmail.com>' . "\n";
>mail($email, "test av website", "helloworld", $headers);


Try this:
$headers = "From: me <it_consultant1@hotmail.com>\n";

>in php.ini I have SMTP = localhost
>
>I haven't got microsoft exchange or similar mail program installed on my pc.
>I have outlook express installed on my pc, so I use outlook express when
>browsing newgroups and sending emails. So I thought if I could send email
>via outlook express then maybe it's possible to send email from a web site
>hosted on the same pc.


It is very possible that you do not have a mail daemon set for PHP to
use. I only do work on *NIX servers, so I do not know.

Perhaps the question you should be asking is, what mailer daemon
should I use for Windows?

Reply With Quote
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT +1. The time now is 01:24 AM.


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.0.0