Php Mail Script Needed my script no longer allowed
#1
Posted 14 December 2005 - 11:30 AM
mail($recipient,$subject,$body,$from)
The reason is that it is sending out mail as nobody which is no longer allowed.
I have many many php pages that use this script to send out receipts to customers. Is there a way to use php to send mail and not have it send it a "nobody". I do put a reply address in the $from variable but obviously that is not what is needed.
Thanks in advanced.
#2
Posted 14 December 2005 - 12:51 PM
-f email@address.com
Lead Forum Moderator
TotalChoice Hosting, L.L.C.
Webhosting by Total Choice Web Hosting - General Support Forum
I am the Lead Forum Moderator. While I can assist in answering most of your hosting related questions, I am unable to answer questions about specifics relating to your account such as billing and server related issues. Should you need assistance in these areas, please contact our Help Desk or our many other options. Another good place to find answers is with our help pages, tutorials and movie tutorials.
#3
Posted 14 December 2005 - 01:09 PM
I have found this reference to the -f switch
<?php
mail('nobody@example.com', 'the subject', 'the message', null,
'-fwebmaster@example.com');
?>
Not sure what the null is. Do I leave this as null? What I want is an email sent out to my customer and to bcc myself.
Would this work?
<?php
mail('customer@example.com', '$subject', '$message', null,
'-fmyaddress@****');
?>
Not sure how I would get this to bcc me as well or can I do this?
#4
Posted 14 December 2005 - 01:22 PM
mail($contactemail, $subject, $message, $headers, "-f".$myemail);
Lead Forum Moderator
TotalChoice Hosting, L.L.C.
Webhosting by Total Choice Web Hosting - General Support Forum
I am the Lead Forum Moderator. While I can assist in answering most of your hosting related questions, I am unable to answer questions about specifics relating to your account such as billing and server related issues. Should you need assistance in these areas, please contact our Help Desk or our many other options. Another good place to find answers is with our help pages, tutorials and movie tutorials.
#5
Posted 14 December 2005 - 01:27 PM
The null that you have should really be the headers;
Try;
$fromname = "me"; $fromemail = "me@here.com"; $toname = "you"; $toemail = "you@there.com"; $subject = "subject of email"; $message = "Test message\n"; $message .= "\n"; $message .= "signed\n"; $headers = "From: $fromname <$fromemail>\r\n"; $headers .= "Reply-To: $fromname <$fromemail>\r\n"; $headers .= "To: $toname <$toemail>\r\n"; $headers .= "bcc: $fromname <$fromemail>\r\n"; $headers .= "MIME-Version: 1.0\r\n"; $headers .= "Content-type: text/html; charset=iso-8859-1\r\n"; $headers .= "X-Priority: 1\r\n"; $headers .= "X-MSMail-Priority: High\r\n"; $headers .= "X-Mailer: My script Mailer\n"; mail($toemail, $subject, $message, $headers, "-f".$fromemail);
You do need to check that any variables you use that allow people to enter values into (ie, from a web page) are checked to ensure they only contain a single email address though - otherwise it quickly becomes very insecure.
#6
Posted 14 December 2005 - 01:49 PM
I will edit my scripts and yes I check the email addresses.
Wayne
#7
Posted 14 December 2005 - 07:58 PM
This is what I have"
$fromname = "wayne";
$fromemail = "wayne@here.com";
$toname = "customer";
$toemail = "customer@there.com";
$subject = "subject of email";
$message = "Test message\n";
$message .= "\n";
$message .= "signed\n";
$headers = "From: $fromname <$fromemail>\r\n";
$headers .= "Reply-To: $fromname <$fromemail>\r\n";
$headers .= "To: $toname <$toemail>\r\n";
$headers .= "bcc: $fromname <$fromemail>\r\n";
$headers .= "MIME-Version: 1.0\r\n";
$headers .= "Content-type: text/html; charset=iso-8859-1\r\n";
$headers .= "X-Priority: 1\r\n";
$headers .= "X-MSMail-Priority: High\r\n";
$headers .= "X-Mailer: My script Mailer\n";
mail($toemail, $subject, $message, $headers, "-f".$fromemail);
I have noticed 2 problems when I run the script as instructed above.
The $toemail address is getting 2 emails. So I removed the $headers entry for the "To" field and now it is fixed (since the $toemail is also in the actual mail() command).
HOWEVER I get the mail to $toname bouncing back. This email address is working as it is on my day job email address (on a server not located at TCH if that means anything). I do get the mail at the bcc address (which is an acount on the TCH server running the script).
The error in the bounced mail is
unrouteable mail domain "there.com"
Any help is much appreciated.
Wayne
#8
Posted 15 December 2005 - 02:44 AM
Although we don't provide coding support via the help desk, open a ticket and we'll take a quick look at why it's failing to that domain.
#9
Posted 15 December 2005 - 08:11 AM
Seems that if I make the address my own domain, I get the mail fine.
#10
Posted 15 December 2005 - 09:15 AM
Lead Forum Moderator
TotalChoice Hosting, L.L.C.
Webhosting by Total Choice Web Hosting - General Support Forum
I am the Lead Forum Moderator. While I can assist in answering most of your hosting related questions, I am unable to answer questions about specifics relating to your account such as billing and server related issues. Should you need assistance in these areas, please contact our Help Desk or our many other options. Another good place to find answers is with our help pages, tutorials and movie tutorials.
#11
Posted 15 December 2005 - 01:14 PM
I opened a help desk ticket and they fixed something on the server end. All is now working with the -f switch.
Thanks all for your advice, as usual service here at TCH ROCKS!!
#12
Posted 15 December 2005 - 01:54 PM
Lead Forum Moderator
TotalChoice Hosting, L.L.C.
Webhosting by Total Choice Web Hosting - General Support Forum
I am the Lead Forum Moderator. While I can assist in answering most of your hosting related questions, I am unable to answer questions about specifics relating to your account such as billing and server related issues. Should you need assistance in these areas, please contact our Help Desk or our many other options. Another good place to find answers is with our help pages, tutorials and movie tutorials.
#13
Posted 15 December 2005 - 03:32 PM

Sign In
Register
Help


MultiQuote