Weird problem
Moderators: Chris Corbyn, General Moderators
-
Lars Boldt
- Forum Newbie
- Posts: 4
- Joined: Mon Mar 31, 2008 8:03 am
Weird problem
I've got a weird problem when sending HTML e-mails...
Before the mail is passed to SWIFT, everything is ok, but when I receive it, randomly, "! " (exclamation mark + space), is inserted in the HTML code. Sometimes I get it for instance in a style tag, PADDING-TOP! :10px, other times in the middle of a word "f! oo".
I've asked my hosting company (where our mail passes through) if any filters (spam or whatever else) could cause this problem to which they responded that is was very unlikely that their email server caused this problem.
It's not the email app either cause I tested the email in an webmail solution and it had the same problem, albeit on the same server.
My question is, could SWIFT cause this?
Before the mail is passed to SWIFT, everything is ok, but when I receive it, randomly, "! " (exclamation mark + space), is inserted in the HTML code. Sometimes I get it for instance in a style tag, PADDING-TOP! :10px, other times in the middle of a word "f! oo".
I've asked my hosting company (where our mail passes through) if any filters (spam or whatever else) could cause this problem to which they responded that is was very unlikely that their email server caused this problem.
It's not the email app either cause I tested the email in an webmail solution and it had the same problem, albeit on the same server.
My question is, could SWIFT cause this?
- Chris Corbyn
- Breakbeat Nuttzer
- Posts: 13098
- Joined: Wed Mar 24, 2004 7:57 am
- Location: Melbourne, Australia
Re: Weird problem
Are you the same person who emailed me earlier? No worries if not; it's just this would be a weird coincidence.
- Chris Corbyn
- Breakbeat Nuttzer
- Posts: 13098
- Joined: Wed Mar 24, 2004 7:57 am
- Location: Melbourne, Australia
Re: Weird problem
My answer to the guy who asked earlier was that it sounds like an incorrect character encoding being specified. Make sure you're specifying the charset when you're using Swift. Swift itself wouldn't do this no, especially not if you're seeing the issue in separate apps.
You can see what Swift is about to send by calling this:
You'll want to use "View Source" in your browser to correctly see the email source.
You can see what Swift is about to send by calling this:
Code: Select all
$stream =& $message->build();
echo $stream->readFull();-
Lars Boldt
- Forum Newbie
- Posts: 4
- Joined: Mon Mar 31, 2008 8:03 am
Re: Weird problem
Hi Chris, I don't believe i've specified an encoding, i'll look into that ASAP.
And no, I didn't email you, as far as I know anyway hehe.
And no, I didn't email you, as far as I know anyway hehe.
- Chris Corbyn
- Breakbeat Nuttzer
- Posts: 13098
- Joined: Wed Mar 24, 2004 7:57 am
- Location: Melbourne, Australia
Re: Weird problem
I don't stress it in my documentation. I really want rock-solid documentation with v4. Heh, I'm even writing a proper e-book for it.Lars Boldt wrote:Hi Chris, I don't believe i've specified an encoding, i'll look into that ASAP.
And no, I didn't email you, as far as I know anyway hehe.
-
Lars Boldt
- Forum Newbie
- Posts: 4
- Joined: Mon Mar 31, 2008 8:03 am
Re: Weird problem
Code: Select all
To:
From:
Subject: test
Date: Wed, 02 Apr 2008 15:08:00 +0200
X-LibVersion: 3.3.2
MIME-Version: 1.0
Content-Type: multipart/alternative;
boundary="_=_swift-200458016047f38530e55be8.83946559_=_"
Content-Transfer-Encoding: 7bit
This is a message in multipart MIME format. Your mail client should not
be displaying this. Consider upgrading your mail client to view this
message correctly.
--_=_swift-200458016047f38530e55be8.83946559_=_
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit
Code: Select all
$message->attach(new Swift_Message_Part($plainTextMsg, "text/plain", "8bit", "utf-8"));
$message->attach(new Swift_Message_Part($messageData, "text/html", "8bit", "utf-8"));
Any ideas?
-
Lars Boldt
- Forum Newbie
- Posts: 4
- Joined: Mon Mar 31, 2008 8:03 am
Re: Weird problem
Upon further testing it seems it is the data coming from mySQL which causes the problem, when it is present in the mail, the "error" can occur in both the mySQL data and/or in the data added directly from code.
If the mySQL data is removed, the error doesn't occur. Furthermore, it doesn't seem it is as random as first thought. If the HTML is inserted into mySQL through IE the error occur in one specific place. If using FF the error occur in another specific place. You can't see the error until it's in your mailbox however heh.
The webpage use UTF-8, the database use UTF-8 and now the mail is sent as UTF-8.
Thoughts?
If the mySQL data is removed, the error doesn't occur. Furthermore, it doesn't seem it is as random as first thought. If the HTML is inserted into mySQL through IE the error occur in one specific place. If using FF the error occur in another specific place. You can't see the error until it's in your mailbox however heh.
The webpage use UTF-8, the database use UTF-8 and now the mail is sent as UTF-8.
Thoughts?
- Chris Corbyn
- Breakbeat Nuttzer
- Posts: 13098
- Joined: Wed Mar 24, 2004 7:57 am
- Location: Melbourne, Australia
Re: Weird problem
Is anything being copied and pasted from an application such as MS Word somewhere along the way? The fact the issue is occurring when crossing a boundary between a browser and the server or MySQL and PHP really does suggest that although you are using UTF-8, there's something non-UTF-8 corrupting the data. There will be a mail server somewhere between Swift and the receiver which is seeing an unexpected octet in the UTF-8 stream and replacing it with ! (like some browsers replace wonky characters with ?)