Welcome Guest, Not a member yet? Register   Sign In
E-Mail Encoding Problem
#1

Hello Guys Wink
i have a problem with sending e-mails and hope you can help me.
The E-Mail Source look different to my View. 

E-Mail Source:
Code:
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"><h3>Welcome to TestSystem</h3>
Your account was successfully created. <br>
To complete the Account-Registration click on the following link: <br ="3E" <a="" href="
http://xxx/Auth/verify/19/jT1mXvaIPBUI0o4l7B04" ="3E" VerifyAccount<="" a="">
<br> <br>
Regards, <br>
your TestSystem Team
View:
PHP Code:
<h3>Welcome to <?php echo $this->config->item('site_name'); ?></h3> 
Your account was successfully created. <br /> 
To complete the Account-Registration click on the following link: <br />
<a href="
    <?php echo $this->config->item('base_url'); ?>Auth/verify/<?php echo $userID?>/<?php echo $verifyCode?>">
    Verify Account
</a>
<br /> <br /> 
Regards, <br /> 
your <?php echo $this->config->item('site_name'); ?> Team 
As you can see, it kills the A-Tag and add something like ="3E"
I dont really know, what it can be.

Send E-mail:
PHP Code:
           $data = array(
        
'userID' => $userID,
 
               'verifyCode' => $verifyCode
        
);
 
           $this->load->library('email');

 
           $this->email->from($this->config->item('from_email'), $this->config->item('site_name'));
 
           $this->email->to($email);
 
           $this->email->set_mailtype("html");
 
           $this->email->subject('Welcome to '.$this->config->item('site_name'));
 
           $this->email->message($this->load->view('email/verify_code'$datatrue));

 
           if($this->email->send()){
 
               return true;
 
           }
 
           else{
 
               return false;
 
           
Thank you ! Smile
Reply
#2

Remove the / on your br's
What did you Try? What did you Get? What did you Expect?

Joined CodeIgniter Community 2009.  ( Skype: insitfx )
Reply
#3

@InsiteFX: really? I have numerous views for sending e-mail, they all have standard html code, including the <br /> tag.
@Waschi, a tip:
PHP Code:
To complete the Account-Registration click on the following link: <br />
<
a href="<?php echo base_url() . 'auth/verify/' . $userID . '/' . $verifyCode;?>">Verify Account</a
Isn't that much better readable (less php code clutter)?
Although your controller files must be in firstcaps, don't use that in your URL's. That's why I changed it to auth/verify.
Reply
#4

Hey Waschi,

The 3E's in your email are encoded '>' characters. So for some reason your character's are converted to another encoding.

There are a couple of things you could check or do to avoid conversion problems:
1. use your editor to check if your file has the right encoding. If you want to send an utf-8 encoded html email, the file encoding has to be utf-8 encoded.
2. to avoid all sorts of vage problems in email clients, you should at least send your html email as a website (as explained in the user manual). With html, head and body tags etc. Be sure that your not using relative links.
3. if you set the mail_type to 'html', use the config to specify which encoding you want to use.

Hope this helps!

-Roger
Reply
#5

@InsiteFX That didnt really helped.
@Wouter60 You are right, that looks really better Big Grin Any reason why i should write the controller (in url) lowercase?

My Solution was to add this: 
PHP Code:
$this->email->set_crlf"\r\n" ); 

Thank you anyway guys Smile  !
Reply




Theme © iAndrew 2016 - Forum software by © MyBB