Hi all,
I have a mail script which is located on a secure server. It's supposed to send two notification messages when an order is placed - one to the customer and one to the site owner.
The script mails out fine to the customer, but not to any email address from the site owner's domain. For example the site is called http://www.mainsite.co.uk, the script is located on http://www.securesite.co.uk. The script will mail any address except anyemailaddress@mainsite.co.uk.
emails can be sent to and from anyemailaddress@mainsite.co.uk - even from exactly the same mail script located on http://www.mainsite.co.uk.
I realise this may not be a php question but can any of you think of a reason why mail() won't send to this particular domain from this server?
Thanks in advance.
Bizarre mail() problem
Moderator: General Moderators
Bizarre mail() problem
Last edited by akpcep on Fri May 30, 2003 4:32 am, edited 1 time in total.
Code: Select all
$input = '<!DOCTYPE HTML PUBLIC "-//W3C//DTD W3 HTML//EN">';
$input .= '<html><head><META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1"><link rel="stylesheet" type="text/css" href="http://www.mainsite.co.uk/styles.css"></head><body>';
$input .="<p align="center"><img src="http://www.mainsite.co.uk/images/order.jpg" alt=""><br><br>\n";
$input .="<table width="600" cellspacing=0 cellpadding=3><tr><td align="center">Thank you for your order. A copy of your details follow for your records.<br>A member of our team will contact you shortly to confirm the order.<br><br></td></tr>\n";
$input .="<tr class="basketheader"><td>Billing Address</td></tr>\n";
$input .="<tr><td><b>Name:</b> $totalname<br><b>Business Name:</b> $BusName<br><b>Address:</b> $Address<br><b>City:</b> $City<br><b>County/State:</b> $State<br><b>Post/Zip Code:</b> $PostCode<br><b>Country</b> $Country<br><b>Telephone:</b> $Phone<br><b>Email:</b> $Email<br><br></td></tr>\n";
$input .="<tr class="basketheader"><td>Delivery Address</td></tr>\n";
$input .="<tr><td><b>Name:</b> $totaldelname<br><b>Business Name:</b> $BusName<br><b>Address:</b> $delAddress<br><b>City:</b> $delCity<br><b>County/State:</b> $delState<br><b>Post/Zip Code:</b> $delPostCode<br><b>Country</b> $delCountry<br><br></td></tr>\n";
$input .="<table width="600" cellspacing=0 cellpadding=3><tr class="basketheader"><td width="10%">Item Code</td><td>Product</td><td width="10%">Size</td><td width="10%">Colour</td><td width="5%">Qty</td><td width="10%">Price</td></tr>\n";
$result2=(mysql_query("SELECT * FROM sessions WHERE sess_id='$sess_id' ORDER BY bid ASC"));
$alt=0;
while($row2=mysql_fetch_array($result2)) {
$bid=$row2['bid'];
$item_code=$row2['item_code'];
$title=stripslashes($row2['title']);
$qty=$row2['qty'];
$price=$row2['price'];
if ($row2['size']) { $size=$row2['size']; } else { $size="-"; }
if ($row2['colour']) { $colour=$row2['colour']; } else { $colour="-"; }
if (is_int($alt/2)) { $bg="innerbox"; } else { $bg="innerbox2"; }
$input.= "<tr class="$bg"><td>" . $item_code . "</td><td>" . $title . "</td><td>" . $size . "</td><td>". $colour . "</td><td>$qty</td><td>£" . number_format($price,2) . "</td></tr>\n";
$alt++;
}
$input .= "</table><table width="600" cellpadding="3" cellspacing="0"><tr class="basket"><td align="left">Sub Total:</td><td align="left" width="10%">£" . number_format($subtotal, 2) . "</td></tr>\n";
$input .= "<tr class="basket"><td align="left">Shipping (UK Only):</td><td align="left">£" . number_format($shipping, 2) . "</td></tr>\n";
$input .= "<tr class="basketheader"><td align="left">Total:</td><td align="left">£" . number_format($total, 2) . "</td></tr>\n";
$input .= "<tr><td align="center"><br><br>If you have any queries regarding your order or payment please contact us quoting Order Reference <b>$the_ref</b>";
$input .="</table></p>";
$input .="</body></html>\n";
$mail_to = $Email;
$subject = "Order No. " . $the_ref;
$headers = "From: Main Site <administrator@mainsite.co.uk>\n";
$headers .= "MIME-Version: 1.0\nContent-Type: text/html; charset=ISO-8859-1\nContent-Transfer-Encoding: 8bit;\n\n";
$headers .= stripslashes(stripslashes($input));
$headers .= "\n";
$admsubject = "Order from $totalname (" . $the_ref . ")";
$admheaders = "From: " . $Email . " <" . $Email . ">\n";
$admheaders .= "MIME-Version: 1.0\nContent-Type: text/html; charset=ISO-8859-1\nContent-Transfer-Encoding: 8bit;\n\n";
$admheaders .= stripslashes(stripslashes($input));
$admheaders .= "\n";
mail("$mail_to", "$subject", "", "$headers");
mail("administrator@mainsite.co.uk", "$admsubject", "", "$admheaders");EDIT - switched it to PHP tags
Last edited by akpcep on Fri May 30, 2003 5:03 am, edited 1 time in total.
A nice feature of this forum is the PHP bbcode, use it when posting PHP, it help make things readable 
Assuming $Email is st by code I can't see, (or that, like a silly billy, you have register globals on and that's the data from a form) I see nothing wrong, other than the fact you're not sending any content, which could be the reason it's not working (blank emails can be sent to cause a User-Targeted DoS, so some servers simply reject them)
Assuming $Email is st by code I can't see, (or that, like a silly billy, you have register globals on and that's the data from a form) I see nothing wrong, other than the fact you're not sending any content, which could be the reason it's not working (blank emails can be sent to cause a User-Targeted DoS, so some servers simply reject them)
Thanks for taking the time to respond - and for the tips!
Email is post data, you're right, but register globals is off (I've set that variable earlier in this script to make the code easier to read).
I know the email isn't blank because if I set the administrator email to my own email for example, it comes through fine and complete. That's whats so puzzling. Unless I'm missing something really obvious (which I hope I am), it literally is not sending mail to one particular domain.
I've tried changing all the parameters I thought might be involved, including from address, headers etc and still no joy. Could the fact it's a secure server be involved, as this same script works fine on the main site server?
Email is post data, you're right, but register globals is off (I've set that variable earlier in this script to make the code easier to read).
I know the email isn't blank because if I set the administrator email to my own email for example, it comes through fine and complete. That's whats so puzzling. Unless I'm missing something really obvious (which I hope I am), it literally is not sending mail to one particular domain.
I've tried changing all the parameters I thought might be involved, including from address, headers etc and still no joy. Could the fact it's a secure server be involved, as this same script works fine on the main site server?