Hello:
I'm a newbie using a very simple script (half dozen lines of code) on my web site server to handle a form. A user's 'name' and 'email' are sent to the script, then script sends email to user... like an autoresponder.
The script uses the php 'mail' function.
My script works great EXCEPT if 'email' is out of my web site domain... then it doesn't work at all.
My server host tells me to "change the script so that the mail server is either localhost or 2k3mail.siteprotect.com" They tell me that my script is currently using smtp.mydomain.com as mail server...
I have not explicitly stated the mail server in my script.
I don't know how to do this with php... do you?
PS: It's a windows server with php installed and I have the php info file and php code if needed.
Thank you for any ideas...
EASY email script question - how to specify mail server?
Moderator: General Moderators
- SystemWisdom
- Forum Commoner
- Posts: 69
- Joined: Sat Mar 26, 2005 5:54 pm
- Location: A Canadian South of the 49th Parallel
You could try:
Code: Select all
ini_set( 'SMTP','localhost' );
// or
ini_set( 'SMTP','2k3mail.siteprotect.com' );SystemWisdom,
You're name is underestimating your skill... You're advise worked!
I'm so happy I can't tell you!
PS: I don't know if it matters... I had to first use mail, then use your ini_set then use mail again. If I don't use the second mail after the ini_set then it won't mail my Bcc to an email in my domain. (?)
ie: mail(abc)
ini_set (xyz)
mail (abc)
NOT
ini_set (xyz)
mail (abc)
PPS: This is a shared serevr if it matters (?)
You're name is underestimating your skill... You're advise worked!
I'm so happy I can't tell you!
PS: I don't know if it matters... I had to first use mail, then use your ini_set then use mail again. If I don't use the second mail after the ini_set then it won't mail my Bcc to an email in my domain. (?)
ie: mail(abc)
ini_set (xyz)
mail (abc)
NOT
ini_set (xyz)
mail (abc)
PPS: This is a shared serevr if it matters (?)
- SystemWisdom
- Forum Commoner
- Posts: 69
- Joined: Sat Mar 26, 2005 5:54 pm
- Location: A Canadian South of the 49th Parallel
Thanks for staying with me...
works, but...
does not (if that's your quesion)
Here's the modified code (the variables 'email' and 'name' are sent to this script via POST from a Flash swf):
PS: It's not that important, but for diagnostic purposes... With our fix in place I get an 'undeliverable' notice from Postfix, even though the mails deliver as expected.
SystemWisdom wrote:Hmm, sounds strange, are you using localhost??
Code: Select all
ini_set( 'SMTP','2k3mail.siteprotect.com' );Code: Select all
ini_set( 'SMTP','localhost' );Here's the modified code (the variables 'email' and 'name' are sent to this script via POST from a Flash swf):
Code: Select all
<?php
$myredirect = "http://www.corporatecar.com/";
$email = $_POST["email"];
$myname = "Corporate Car";
$mymail = "CustomerService@CorporateCar.com";
$subject = "***** Yada Yada ******";
$body = $_POST["name"] . ", here is yada yada...
Thanks for the help... much appreciated";
$headers = "Content-Type: text/plain; charset=us-ascii\nFrom: $myname <$mymail>\nBcc:<$mymail>\nReply-To: <$mymail>\nReturn-Path: <$mymail>\nX-Mailer: PHP";
ini_set( 'SMTP','2k3mail.siteprotect.com' );
mail($email,$subject,$body,$headers);
?>PS: It's not that important, but for diagnostic purposes... With our fix in place I get an 'undeliverable' notice from Postfix, even though the mails deliver as expected.
...is from my lack of complete testing and an error on my part - sorry about that.forzato wrote: I had to first use mail, then use your ini_set then use mail again. If I don't use the second mail after the ini_set then it won't mail my Bcc to an email in my domain. (?)
ie: mail(abc)
ini_set (xyz)
mail (abc)
NOT
ini_set (xyz)
mail (abc)
- SystemWisdom
- Forum Commoner
- Posts: 69
- Joined: Sat Mar 26, 2005 5:54 pm
- Location: A Canadian South of the 49th Parallel