email - PHP mail function missing characters -
i have weird error mail() function in php.
this code i'm using send message:
$to = strip_tags($_post['newmail']); $subject = "company: update email address "; $message = $mailheader.'<b>hello company!</b><br/> <br/> please confirm new email address clicking link: <a href="http://www.company.com/confirm.php?regid='.$regid.'&newemail='.mysql_escape_string($_post['newmail']).'" class="link"> confirm email address change</a><br/><br/><p class="p"><b>thank you.</b></p><br/><b class="h2">company.</b>'.$mailfooter; $from = "<noreply@company.com>"; $headers = "mime-version: 1.0\r\n"; $headers .= "content-type: text/html; charset=iso-8859-1\r\n"; $headers .= "from: company name" . $from. " \r\n"; to note, company name has been replaced 'company'.
edit - $mailheader
<html> <style> /* `xhtml, html4, html5 reset ----------------------------------------------------------------------------------------------------*/ body { border: 0; margin: 0; padding: 0; font-size: 100%; } html, body { height: 100%; } .link{ color:#81c6f6; text-decoration:none; } .link:visited { color:#81c6f6; } .link:hover { color:#f6b181; } .h1{ color:#696969; font:20px/1.5 helvetica, geneva, sans-serif; } .p{ padding:2px; color:#787878; font:16px/1.5 tahoma, geneva, sans-serif; } .h2{ padding:2px; color:#81c6f6;; font:16px/1.5 tahoma, geneva, sans-serif; } .roundall{ -moz-border-radius:20px; border-radius:20px; -webkit-radius: 20px; } #header{ height:71px; width:100%; background-color:#99d1f8; } #automarginwrap{ width:90%; margin:0 auto; text-align:center; } #content{ margin:0 auto; padding:10px; width:80%; border: solid 10px #f1f1f1; background-color:#fff; } </style> <body> <div id="header"><center><img src="http://www.downloadablecreations.com/images/logo.png" /></center></div> <div id="automarginwrap"> <div id="content" class="roundall h1"> $mailfooter -
</div> </div> </body> </html> now works fine, mail sent , received no error message appear, when click on link, directs me url missing either 'w' in href part of message (mail.app apple):
<a href="http://ww.company.com/confirm.php? or random letter link:
<a href="http://www.compay.com/confirm.php? am doing wrong?
i believe error lies in charset aspect of email or encoding.
edit - removing mysql_escape_string() made no difference result.
could line longer 70 characters? php manual states lines should no longer 70 characters.
this answer may useful.
personally, i've had problem email clients truncating long lines of text, similar describing. best way fix either break lines apart or use framework or method better equipped send html mail.
the manual recommends pear::mail_mine. recommend zend mail if using zf, though. going framework make life easier in long run, when dealing many different mail servers , clients.
Comments
Post a Comment