HTML e-mail with attachment problem |
[eluser]rweston[/eluser]
Hello, when trying to send html e-mail, everything is 100% fine. As soon as i add an attachment, the html portion of the e-mail does not display at all, but it is there ( when i use "Show Original" with gmail ). I comment the attachment out, and it's fine. The attachment comes thru fine though when it is left in. Anything i'm missing? I appreciate the help. This is not being called in any sort of loop. Code: $this -> load -> library('email');
[eluser]sophistry[/eluser]
what about other web email services and clients? how do they treat the email? advise testing yahoo, hotmail, etc... as well as desktop clients like outlook, thunderbird, and mail.app HTML email is pretty tricky to get right across all services. and if you throw in attachments... well, even more complicated. also, each service is constantly changing their code base so today might be the first day of some new random buggy feature they rolled out. i looked at the CI Email.php library and it looks like it should be handling your situation properly (aka to email RFC standards), but trying out a spectrum of other services will give some better idea if it is CI's problem or an individual service kink.
[eluser]rweston[/eluser]
[quote author="sophistry" date="1204748680"]what about other web email services and clients? how do they treat the email? advise testing yahoo, hotmail, etc... as well as desktop clients like outlook, thunderbird, ...[/quote] I tested with Yahoo & Hotmail. It's the same exact issue with Yahoo but, with hotmail it displays the html rather than rendering it. But the same happens with the phpmailer(sourceforge) so i'm thinking it might be the mail server (hmail) and something i've not configured properly? Come to think of it, this is the first time i'm attempting to send an e-mail with an attachment via hmail. I'll spend some time on their forums as well and see what i come across. And will try another mailserver as well.
[eluser]rweston[/eluser]
Maybe this will allow someone to help me better; below is the debug output from the CI mail class. I've attempted to construct a *very* basic message with an attachment and still no go: I replaced my domain name with {mydomain} Code: Debug:Your message has been successfully sent using the following protocol: mail
[eluser]rweston[/eluser]
I've even tried 'full' html for the html body. html head title - /title /head body message /body /html
[eluser]sophistry[/eluser]
please return with a debug matrix of where your email sending breaks down so you can isolate the problem. tests (for each service): send plaintext alone send html alone send attachment "alone" send text and html send text and attachment send html and attachment send all three also, RFC 2046 makes for edifying reading see esp section 5.1.3 and 5.1.4 for multipart standards. those section detail the difference between alternative and mixed multiparts - there may be something in changing the default mixed to default to alternative. finally, it looks like you didn't paste all of the email because there is no closing boundary on the base64 encoded attachment. according to the CI Email.php library code a closing boundary is added.
[eluser]stef25[/eluser]
similar problem - html email arrives as html code. not a server issue cause phpmailer works fine. any xss filtering is off ... any idea what could cause this?
[eluser]rweston[/eluser]
[quote author="stef25" date="1204755787"]similar problem - html email arrives as html code. not a server issue cause phpmailer works fine. any xss filtering is off ... any idea what could cause this?[/quote] If phpmailer works fine, then maybe for CI, you've gotta state that you're sending html e-mail. Either with $config in email.php in the config folder or with $email -> initialize($config)? Have you tried either?
[eluser]stef25[/eluser]
Sure ... i just thought there would be a simple answer, like something to do with filtering for security. here is my entire controller. please ignore the success / fail messages at the bottom, thats another issue. the mail arrives fine with all the from / to emails and names filled in properly. only issue is that the body of the email is <p>all your base are belong to us</p>. this is the case both in Outlook and Gmail. Mail is sent via our linux dev machine on which phpmailer had no problem sending out html email. All this code is very straightforward ... im stumped! Code: class Mailer extends Controller { |
Welcome Guest, Not a member yet? Register Sign In |