Ask a Question related to Macromedia Dynamic HTML, Design and Development.
-
Gamespy007 #1
Problems PHP email function
I am trying to create a page that can send emails using PHP. But i keep
getting the following error:
Warning: mail() [function.mail]: "sendmail_from" not set in php.ini or custom
"From:" header missing
I am running these off of my computer on an apache test server on my windows
os. My php.ini is set up as:
[mail function]
; For Win32 only.
SMTP = smtp.aol.com
smtp_port = 25
; For Win32 only.
;sendmail_from = [email]myemailaddress@aol.com[/email] (not I used my actual email address)
and my script is:
<?php
echo "<p>Thank you, <b>$_POST[name]</b>, for your message!</p>";
echo "<p>Your e-mail address is: <b>$_POST[email]</b>.</p>";
echo "<p>Your message was:<br>";
echo "$_POST[message] </p>";
//start building the mail string
$msg = "Name: $_POST[name]\r\n";
$msg .= "E-Mail: $_POST[email]\r\n";
$msg .= "Message: $_POST[message]\r\n";
//set up the mail
$recipient = "you@yourdomain.com";
$subject = "Form Submission Results";
$mailheaders = "From: My Web Site <gamespy007@aol.com> \r\n";
$mailheaders .= "Reply-To: $_POST[email]";
//send the mail
mail($recipient, $subject, $msg, $mailheaders);
?>
Could anyone tell me if they see anything wrong and what I should do to
correct it. Thanks.
Gamespy007 Guest
-
Email Problems
I have emails that are getting moved to the undelivered folder. The only thing I can determine that they have in common is a long list of users in... -
Email from website function not working
I used Publisher to create a website in which I want to be able for users to complete a form, press the submit button and the site will then email... -
#12335 [Com]: mail() function returns false but the email was sent.
ID: 12335 Comment by: liliana at civc dot inf dot cu Reported By: sascha dot winkler at ks dot sel dot alcatel dot de... -
Email problems with Extras.
Hi there. I'm in the process of creating a projector which requires the end user to email an external cast file back to me. I've tried several of... -
problems with Apple email
hello. i am using a lime green iMac with Mac OS 10.2 installed, and am having a problem with my Mail program. The inbox refuses to display my new... -
rob::db #2
Re: Problems PHP email function
Your send_mail from line is commented out, you need to delete the initial
semi-colon.
Gamespy007 wrote:> I am trying to create a page that can send emails using PHP. But i
> keep getting the following error:
>
> Warning: mail() [function.mail]: "sendmail_from" not set in php.ini
> or custom "From:" header missing
>
> I am running these off of my computer on an apache test server on my
> windows os. My php.ini is set up as:
>
> [mail function]
> ; For Win32 only.
> SMTP = smtp.aol.com
> smtp_port = 25
>
> ; For Win32 only.
> ;sendmail_from = [email]myemailaddress@aol.com[/email] (not I used my actual email
> address)
>
> and my script is:
>
> <?php
> echo "<p>Thank you, <b>$_POST[name]</b>, for your message!</p>";
> echo "<p>Your e-mail address is: <b>$_POST[email]</b>.</p>";
> echo "<p>Your message was:<br>";
> echo "$_POST[message] </p>";
> //start building the mail string
> $msg = "Name: $_POST[name]\r\n";
> $msg .= "E-Mail: $_POST[email]\r\n";
> $msg .= "Message: $_POST[message]\r\n";
> //set up the mail
> $recipient = "you@yourdomain.com";
> $subject = "Form Submission Results";
> $mailheaders = "From: My Web Site <gamespy007@aol.com> \r\n";
> $mailheaders .= "Reply-To: $_POST[email]";
> //send the mail
> mail($recipient, $subject, $msg, $mailheaders);>>>
> Could anyone tell me if they see anything wrong and what I should do
> to correct it. Thanks.
rob::db Guest
-
Gamespy007 #3
Re: Problems PHP email function
I removed the semi-colon and am still getting the same error. The php.ini
looks like:
[mail function]
; For Win32 only.
SMTP = smtp.aol.com
smtp_port = 25
; For Win32 only.
sendmail_from = [email]myemailaddress@aol.com[/email] (not I used my actual email address)
And the php script is still the same as above. Do you see anything else wrong
with my code.
Gamespy007 Guest
-
rob::db #4
Re: Problems PHP email function
It may be that your setup won't let you connect to a remote email server, or
more likely, the remote server won't let you connect to it. Not sure
though...
Gamespy007 wrote:> I removed the semi-colon and am still getting the same error. The
> php.ini looks like:
>
> [mail function]
>
> ; For Win32 only.
> SMTP = smtp.aol.com
> smtp_port = 25
>
> ; For Win32 only.
> sendmail_from = [email]myemailaddress@aol.com[/email] (not I used my actual email
> address)
>
> And the php script is still the same as above. Do you see anything
> else wrong with my code.
rob::db Guest
-
Gamespy007 #5
Re: Problems PHP email function
I think your right. After I took out the semi-colon, I got this error message:
Warning: mail() [function.mail]: Failed to connect to mailserver at
"smtp.localhost" port 25, verify your "SMTP" and "smtp_port" setting in php.ini
or use ini_set()
I tried to change my smtp from aol to localhost, But am still getting the same
error. I am using an apache server on my home desktop as a test server. Is
there anyway I can use it for my smtp?
Gamespy007 Guest
-
rob::db #6
Re: Problems PHP email function
Well, if you install a Sendmail server or something like it on your testing
server, then you can send email from it (Apache is just a web server, it
doesn't deal with email). That's a massive amount of trouble though. It's
easier just to leave testing the mail functions until the site's on a proper
live host.
Gamespy007 wrote:> I think your right. After I took out the semi-colon, I got this
> error message:
>
> Warning: mail() [function.mail]: Failed to connect to mailserver at
> "smtp.localhost" port 25, verify your "SMTP" and "smtp_port" setting
> in php.ini or use ini_set()
>
> I tried to change my smtp from aol to localhost, But am still
> getting the same error. I am using an apache server on my home
> desktop as a test server. Is there anyway I can use it for my smtp?
rob::db Guest



Reply With Quote

