Details
-
Type:
Bug
-
Status:
Resolved
-
Priority:
Major
-
Resolution: Not an Issue
-
Affects Version/s: 0.8.0
-
Fix Version/s: None
-
Component/s: Zend_Mail
-
Labels:None
Description
Using PHP Version 5.1.6-pl6-gentoo, I tried to use Zend_Mail to send a confirmation email upon a user registration. I use HTML emails, and Zend's default transporter.
But sometimes spaces are inserted in the words, which would not be that bad if it didn't also sometimes break the link that the user must click in order to activate his account.
Edit 2007/03/13: I'll add that this behaviour has occurred when viewing the sent email in Gmail, and Mozilla Thunderbird. So far, my tests using Hotmail and Yahoo Mail have produced intact emails. Something to do with how the mail clients interprete the maximum line lengths, perhaps....
Here is some test code I made for an example:
<?
require_once('Zend.php');
function __autoload($class_name) {
Zend::loadClass($class_name);
}
define('SITE_NAME', 'MySite');
$email = 'v.marchand@gmail.com';
$username = 'vero';
$fullName = 'Vero. M.';
$url = 'http://www.' . SITE_NAME . '.com/Inscription/Confirmer/key/7b2836967a0829a13c4c910683c82038e582afac';
$body = "
<html>
<head>
<style>
body { font-family: Arial, Helvetica; font-size: 13px; }
</style>
</head>
<body>
<p> Bonjour <b>" . $fullName . "</b>,</p>
<p>Merci de vous être enregistré avec <b>" . SITE_NAME . "</b>.</p>
<p>
Votre compte " . $username . " est présentement inactif. Pour être activé, il doit d'abord être validé en deux étapes.<br />
Pour la première étape de validation votre compte, veuillez tout simplement cliquer sur le URL ci-dessous (vous pouvez également le copier dans votre navigateur):
</p>
<a href='" . $url . "'>" . $url . "</a>
<p>Une fois votre adresse email validée, votre compte sera revu par l'équipe " . SITE_NAME . " et activé. </p>
<p>Merci!</p>
<p>L'Équipe " . SITE_NAME . "</p>
</body>
</html>
";
$mail = new Zend_Mail();
$mail->setFrom('v.marchand@gmail.com', SITE_NAME);
$mail->addTo($email, $fullName);
$mail->setSubject('Votre inscription à ' . SITE_NAME);
$mail->setBodyHtml($body);
$mail->send();
?>
Here is the email I received on Gmail. Note the broken link, both in display (the space) and in the actual href (after the http:// )
< body>
Bonjour Vero. M.,
Merci de vous être e nregistré avec MySite.
Votre compte vero est pré sentement inactif. Pour être activé, il doit d'abord être validé e n deux étapes.
Pour la première étape de validation votre co mpte, veuillez tout simplement cliquer sur le URL ci-dessous (vous pouvez également le copier dans votre navigateur):
http://www.MySite.com/Inscription/Confirmer/key/7b2836967a0829a13 c4c910683c82038e582afacUne fois votre adresse email validée, v otre compte sera revu par l'équipe MySite et activé.
Merc i!
L'Équipe MySite
Here is the email content with the full headers, in case it helps:
Delivered-To: v.marchand@gmail.com
Received: by 10.114.25.12 with SMTP id 12cs11848way;
Mon, 12 Mar 2007 08:19:35 -0700 (PDT)
Received: by 10.90.104.14 with SMTP id b14mr4553398agc.1173712775222;
Mon, 12 Mar 2007 08:19:35 -0700 (PDT)
Return-Path: <apache@zeus.opale>
Received: from zeus.opale (modemcable042.27-70-69.static.videotron.ca [69.70.27.42])
by mx.google.com with ESMTP id i5si8402101nzi.2007.03.12.08.19.34;
Mon, 12 Mar 2007 08:19:35 -0700 (PDT)
Received-SPF: neutral (google.com: 69.70.27.42 is neither permitted nor denied by best guess record for domain of apache@zeus.opale)
Received: by zeus.opale (Postfix, from userid 81)
id 8097A105A7; Mon, 12 Mar 2007 11:19:34 -0400 (EDT)
To: "Vero. M." <v.marchand@gmail.com>
Subject: =?iso-8859-1?Q?Votre inscription =E0 MySite?=
From: "MySite" <v.marchand@gmail.com>
To: "Vero. M." <v.marchand@gmail.com>
Content-Type: text/html; charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
Content-Disposition: inline
Message-Id: <20070312151934.8097A105A7@zeus.opale>
Date: Mon, 12 Mar 2007 11:19:34 -0400 (EDT)=0A<html>=0A <head>=0A <style>=0A body
Unknown macro: { font-family}=0A </style>=0A </head>=0A<=body>=0A=0A<p> Bonjour <b>Vero. M.</b>,</p>=0A=0A<p>Merci de vous =EAtre e=
nregistr=E9 avec <b>MySite</b>.</p>=0A=0A<p>=0AVotre compte vero est pr=E9=
sentement inactif. Pour =EAtre activ=E9, il doit d'abord =EAtre valid=E9 e=
n deux =E9tapes.<br />=0APour la premi=E8re =E9tape de validation votre co=
mpte, veuillez tout simplement cliquer sur le URL ci-dessous (vous pouvez=
=E9galement le copier dans votre navigateur):=0A</p>=0A<a href=3D'http://=
www.MySite.com/Inscription/Confirmer/key/7b2836967a0829a13c4c910683c82038e=
582afac'>http://www.MySite.com/Inscription/Confirmer/key/7b2836967a0829a13=
c4c910683c82038e582afac</a>=0A<p>Une fois votre adresse email valid=E9e, v=
otre compte sera revu par l'=E9quipe MySite et activ=E9. </p>=0A=0A<p>Merc=
i!</p>=0A=0A<p>L'=C9quipe MySite</p>=0A=0A</body>=0A</html>=0A
Any suggestions? Perhaps there is a method I should use or setting I should change, but I'm not sure what exactly.
Thanks for your help.
PS: also you might notice that the "to" recipient is there twice. I think this is a known bug, but I'm bringing it up here too, because it's been slightly bothering me. ![]()
clarification