Welcome Guest, Not a member yet? Register   Sign In
html emails using email class
#1

[eluser]rossmurphy[/eluser]
I'm trying to send html email with the email class. This is my code..

Code:
$config['mailtype'] = 'html';

$this->email->initialize($config);

$this->email->from($this->config->item('support_email'), $this->config->item('support_name'));
$this->email->to($this->input->post('email'));

$this->email->subject(lang('email.subject.forgot.password'));

$message = $this->parser->parse('email-templates/'.$this->config->item('language').'/forgot_password_template.html', $email_data, TRUE);
$this->email->message($message);

$this->email->send();

This is my template:

Code:
<html>
<head>

<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>{site_name} | Forgot Password Notification</title>

</head>
<body style="background-color:#f7f7f7;">

<div style="border:5px solid #ffffff; width:642px; background-color:#ffffff;">
    
    <div style="height:16px; padding:6px 4px 4px 8px; color:#016599; font-family:Arial, Sans-serif; width:630px; font-size:11px; font-weight:bold; background-color:#e3f4f8;">
        {site_name} | Forgot Password Notification
    </div>
    
    <div style="border:1px solid #e3f4f8; background-color:#ffffff; padding:20px; font-family:Arial, Sans-serif; font-size:13px; width:600px;">
        
        <p style="padding:0; margin:0;">

            <span style="font-size:19px;">Dear, {alias}!</span>
            <br /><br />
            
            You recently went through the password recovery process at {site_name}. The recovery was successful.
            <br /><br />
            
            <div style="width:98%; height:23px; padding:8px 0 4px 2%; background-color:#f6f6f6; border:1px solid #eeeeee; border-width:1px 1px 4px 1px; margin:12px 0;">
                <span style="font-weight:bold;">Your password is:</span> {password}
            </div>
            
            If you feel you are receiving this email in error, please contact {support_email}.
            <br /><br />
                    
            <div style="width:98%; height:23px; padding:8px 0 4px 2%; background-color:#f6f6f6; border-top:1px solid #eeeeee; border-bottom:1px solid #eeeeee; margin:12px 0;">
                <a style="text-decoration:none;" href="{egift_link}">Click here</a> to go to the login page.<br />
            </div>
            <br /><br />
            
            All the best,
            <br /><br />
            <span style="font-weight:bold;">{site_name} Team.</span>

        </p>
    </div>
</div>
&lt;/body&gt;
&lt;/html&gt;

And for some reason i receive this in outlook. I feel like its a charset or encoding problem.

Quote:=09
Default Lobby | Forgot Password Notification
=09
=09
Dear, user!

=09 You recently went through the password recovery process at Default Lobby= .. The recovery was successful.

=09

Your password is: password
=09 If you feel you are receiving this email in error, please contact suppor= [email protected].

=09
Click here= to go to the login page.



=09 All the best,

Default Lobby Team.

--B_ALT_4b4a52d3568e0--
#2

[eluser]JHackamack[/eluser]
Try also setting the character set of the email.
#3

[eluser]rossmurphy[/eluser]
tried utf-8 and iso and still same. anyone else had this problem. shouldnt i been using utf-8 though?
#4

[eluser]JHackamack[/eluser]
Are you only seeing this problem in outlook? or have you tested on other email clients and are seeing the same problem. Also, looking through an email class i've been able to get to successfully go through, try changing adding this little bit of html to your email:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

or another doctype format that you use.
#5

[eluser]sophistry[/eluser]
FWIW, =09 is hex code for the TAB character
#6

[eluser]danmontgomery[/eluser]
Post full headers of email?
#7

[eluser]rossmurphy[/eluser]
Quote:Your message has been successfully sent using the following protocol: mail

User-Agent: CodeIgniter
Date: Mon, 11 Jan 2010 16:43:45 -0500
From: "Test Support"
Return-Path:
Reply-To: "[email protected]"
X-Sender: [email protected]
X-Mailer: CodeIgniter
X-Priority: 3 (Normal)
Message-ID: <[email protected]>
Mime-Version: 1.0
Content-Type: multipart/alternative; boundary="B_ALT_4b4b9b91871a5"

This is a multi-part message in MIME format.
Your email application may not support this format.

--B_ALT_4b4b9b91871a5
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit

Default Lobby | Forgot Password Notification

Dear, {alias}!

You recently went through the password recovery process at Default Lobby.
The recovery was successful.

Your password is: password

If you feel you are receiving this email in error, please contact
[email protected].

Click here to go to the login page.

All the best,

Default Lobby Team.


--B_ALT_4b4b9b91871a5
Content-Type: text/html; charset=utf-8
Content-Transfer-Encoding: quoted-printable
=?utf-8?Q?Password_Retrieval?=
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.=
w3.org/TR/html4/loose.dtd">
&lt;html&gt;
&lt;head&gt;
&lt;title&gt;Default Lobby | Forgot Password Notification&lt;/title&gt;

&lt;/head&gt;
&lt;body style=3D"background-color:#f7f7f7;"&gt;

<div style=3D"border:5px solid #ffffff; width:642px; background-color:#ffff=
ff;">
=09
<div style=3D"height:16px; padding:6px 4px 4px 8px; color:#016599; font-fa=
mily:Arial, Sans-serif; width:630px; font-size:11px; font-weight:bold; back=
ground-color:#e3f4f8;">
Default Lobby | Forgot Password Notification
</div>
=09
<div style=3D"border:1px solid #e3f4f8; background-color:#ffffff; padding:=
20px; font-family:Arial, Sans-serif; font-size:13px; width:600px;">
=09
<p style=3D"padding:0; margin:0;">

<span style=3D"font-size:19px;">Dear, {alias}!</span>
<br /><br />
=09
You recently went through the password recovery process at Default Lobby=
. The recovery was successful.
<br /><br />
=09
<div style=3D"width:98%; height:23px; padding:8px 0 4px 2%; background-c=
olor:#f6f6f6; border:1px solid #eeeeee; border-width:1px 1px 4px 1px; margi=
n:12px 0;">
<span style=3D"font-weight:bold;">Your password is:</span> password
</div>
=09
If you feel you are receiving this email in error, please contact suppor=
[email protected].
<br /><br />
=09
<div style=3D"width:98%; height:23px; padding:8px 0 4px 2%; background-c=
olor:#f6f6f6; border-top:1px solid #eeeeee; border-bottom:1px solid #eeeeee=
; margin:12px 0;">
<a >Click here</a>=
to go to the login page.<br />
</div>
<br /><br />
=09
All the best,
<br /><br />
<span style=3D"font-weight:bold;">Default Lobby Team.</span>

</p>
</div>
</div>
&lt;/body&gt;
&lt;/html&gt;

--B_ALT_4b4b9b91871a5--
#8

[eluser]JHackamack[/eluser]
It looks like it might be something with the newlines and tabs. Have you tried removing the white space in your html?
#9

[eluser]sophistry[/eluser]
also, this string in the HTML part looks wrong:

=?utf-8?Q?Password_Retrieval?=

what is that doing there? it looks like it is supposed to be a subject, but it is getting stuffed into the message.
#10

[eluser]rossmurphy[/eluser]
I removed the white space lines, now i'm getting this...

Quote:Default Lobby | Forgot Password Notification
Dear, {alias}!

You recently went through the password recovery process at Default Lobby= .. The recovery was successful.

Your password is: password
If you feel you are receiving this email in error, please contact suppor= [email protected].

=09
Click here= to go to the login page.


All the best,

Default Lobby Team.

--B_ALT_4b4b9fdb0f822--

Quote:Your message has been successfully sent using the following protocol: mail

User-Agent: CodeIgniter
Date: Mon, 11 Jan 2010 17:02:02 -0500
From: "Parlay Support"
Return-Path:
Reply-To: "[email protected]"
X-Sender: [email protected]
X-Mailer: CodeIgniter
X-Priority: 3 (Normal)
Message-ID: <[email protected]>
Mime-Version: 1.0
Content-Type: multipart/alternative; boundary="B_ALT_4b4b9fdb0f822"

This is a multi-part message in MIME format.
Your email application may not support this format.

--B_ALT_4b4b9fdb0f822
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit

Default Lobby | Forgot Password Notification

Dear, {alias}!

You recently went through the password recovery process at Default Lobby.
The recovery was successful.

Your password is: password

If you feel you are receiving this email in error, please contact
[email protected].

Click here to go to the login page.

All the best,

Default Lobby Team.


--B_ALT_4b4b9fdb0f822
Content-Type: text/html; charset=utf-8
Content-Transfer-Encoding: quoted-printable
=?utf-8?Q?Test_subject?=
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.=
w3.org/TR/html4/loose.dtd">
&lt;html&gt;
&lt;head&gt;
&lt;title&gt;Default Lobby | Forgot Password Notification&lt;/title&gt;
&lt;/head&gt;
&lt;body style=3D"background-color:#f7f7f7;"&gt;
<div style=3D"border:5px solid #ffffff; width:642px; background-color:#ffff=
ff;">
<div style=3D"height:16px; padding:6px 4px 4px 8px; color:#016599; font-fa=
mily:Arial, Sans-serif; width:630px; font-size:11px; font-weight:bold; back=
ground-color:#e3f4f8;">
Default Lobby | Forgot Password Notification
</div>
<div style=3D"border:1px solid #e3f4f8; background-color:#ffffff; padding:=
20px; font-family:Arial, Sans-serif; font-size:13px; width:600px;">
<p style=3D"padding:0; margin:0;">
<span style=3D"font-size:19px;">Dear, {alias}!</span>
<br /><br />
You recently went through the password recovery process at Default Lobby=
. The recovery was successful.
<br /><br />
<div style=3D"width:98%; height:23px; padding:8px 0 4px 2%; background-c=
olor:#f6f6f6; border:1px solid #eeeeee; border-width:1px 1px 4px 1px; margi=
n:12px 0;">
<span style=3D"font-weight:bold;">Your password is:</span> password
</div>
If you feel you are receiving this email in error, please contact suppor=
[email protected].
<br /><br />=09
<div style=3D"width:98%; height:23px; padding:8px 0 4px 2%; background-c=
olor:#f6f6f6; border-top:1px solid #eeeeee; border-bottom:1px solid #eeeeee=
; margin:12px 0;">
<a >Click here</a>=
to go to the login page.<br />
</div>
<br /><br />
All the best,
<br /><br />
<span style=3D"font-weight:bold;">Default Lobby Team.</span>
</p>
</div>
</div>
&lt;/body&gt;
&lt;/html&gt;

--B_ALT_4b4b9fdb0f822--




Theme © iAndrew 2016 - Forum software by © MyBB