Lassie Posted January 11, 2007 Share Posted January 11, 2007 I have constructed an email to notify cusstomers of a download link.My script works without the line providing the link but not with it included.i dont get any error messages.[code]$to = "$email"; $subj = "test"; $mess = "<html>\n" ."<head>\n" ."<title>Test Mail</title>\n" ."</head>\n" ."<body>\n" ."This is an html email test<br />\n" ."<p><b>Your order has been processed. Please click on the link to download your purchase</b></p>\n" .'<p><a href="http://217.46.159.226/e_cart8/prompt.php">Download Your Purchase</a></p>\n'//error ."</body>\n" ."</html>\n"; $mess = wordwrap($mess,70); $headers = 'MIME-Version: 1.0' . "\r\n"; $headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n"; mail($to,$subj,$mess,$headers);[/code]Why should this be?lassie Quote Link to comment https://forums.phpfreaks.com/topic/33753-email-failure/ Share on other sites More sharing options...
c4onastick Posted January 11, 2007 Share Posted January 11, 2007 It looks good. The only thing I can see that may give you trouble (and not the kind of trouble you're experiencing mind you) is the '\n' at the end of the line in question will not be interpolated in single quotation marks. [quote=Lassie][code] .'<p><a href="http://217.46.159.226/e_cart8/prompt.php">Download Your Purchase</a></p>\n'//error[/code][/quote]For this reason I usually use single quotes for quoted strings in html (just my opinion), or you can escape the double quotes. I wonder if a naked '\n' in the message is doing something funky. Try changing it to this:[code] ."<p><a href='http://217.46.159.226/e_cart8/prompt.php'>Download Your Purchase</a></p>\n"[/code]Or this:[code] ."<p><a href=\"http://217.46.159.226/e_cart8/prompt.php\">Download Your Purchase</a></p>\n"[/code] Quote Link to comment https://forums.phpfreaks.com/topic/33753-email-failure/#findComment-158324 Share on other sites More sharing options...
Lassie Posted January 11, 2007 Author Share Posted January 11, 2007 Hi,Thanks for that. I tried both and both still fail.Anybody know a different way of approaching this? Quote Link to comment https://forums.phpfreaks.com/topic/33753-email-failure/#findComment-158382 Share on other sites More sharing options...
HuggieBear Posted January 11, 2007 Share Posted January 11, 2007 Sure,Try this:[code]<?php$to = "$email";$subj = "test";$mess = <<<HTML<html> <head> <title>Test Mail</title> </head> <body> This is an html email test<br /> <p><b>Your order has been processed. Please click on the link to download your purchase</b></p> <p><a href="http://217.46.159.226/e_cart8/prompt.php">Download Your Purchase</a></p> </body></html>HTML;$mess = wordwrap($mess,70); $headers = "MIME-Version: 1.0\r\n";$headers .= "Content-type: text/html; charset=iso-8859-1\r\n"; mail($to,$subj,$mess,$headers);?>[/code]RegardsHuggie Quote Link to comment https://forums.phpfreaks.com/topic/33753-email-failure/#findComment-158385 Share on other sites More sharing options...
Psycho Posted January 11, 2007 Share Posted January 11, 2007 You should echo $mess to the page before and after the wordwrap function to see that is not getting messed up. Quote Link to comment https://forums.phpfreaks.com/topic/33753-email-failure/#findComment-158387 Share on other sites More sharing options...
redbullmarky Posted January 11, 2007 Share Posted January 11, 2007 when you say it doesnt work, do you mean you just get a blank page? or are you judging its failure on the email not arriving?from my experience of emails, ones that provide a link to an IP address, rather than a domain name, often get binned into Junk Mail or flagged as Scams, so it might be worth checking these folders if you havent already.Also, try removing the wordwrap line. there is a slight chance that PHP adding in extra \n could be breaking certain HTML tags in half, therefore rendering some bits useless. For a HTML-formatted email, it's generally unlikely you'll need the wordwrap anyway as most email clients will take care of this.cheers Quote Link to comment https://forums.phpfreaks.com/topic/33753-email-failure/#findComment-158389 Share on other sites More sharing options...
Lassie Posted January 11, 2007 Author Share Posted January 11, 2007 Thanks for the response guys.I checked spam and sure enough the mail was there.far from perfect yet but I can now move on,Thanks again everybodylassie Quote Link to comment https://forums.phpfreaks.com/topic/33753-email-failure/#findComment-158515 Share on other sites More sharing options...
HuggieBear Posted January 12, 2007 Share Posted January 12, 2007 Try adding a few more headers. A search on google for something like [i]php +hotmail +mail()[/i] will give you ideas as to what headers mail clients do and don't like as spam.RegardsHuggie Quote Link to comment https://forums.phpfreaks.com/topic/33753-email-failure/#findComment-158958 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.