0

I'm not sure what the issue is. I've checked all my encodings and they are all set to UTF-8 and no matter what the emails come in weird text. Not everything just throws in a weird letter at the end of words for some reason.

Example of email

The Server has finished transcoding your file for you=. 

You can click on this This Link to view your file before downloadin=

Thanks,

Then here is my code. Everything looks fine to me. Doesn't matter if Windows or Mac still shows weird.

    $config = Array(
                'protocol' => 'smtp',
                'smtp_host' => 'my.smtp.server.com:25',
                'mailtype'  => 'html', 
                'CharSet'   => 'UTF-8');

            //set common email values
            $this->load->library('email', $config);
            $this->email->set_newline("\r\n");
            $this->email->subject('Completed Transcoding');

            $this->email->message("
            <html>
            <head>
            <style type='text/css'>
            tr:nth-of-type(odd) {
            background-color: #bdc8d2;
            </style>
            </head>
            Hello $uploader,<br><br>The Server has finished transcoding your file for you.
            <br><br>You can click on this <a href='#/$transcoding_id'>This Link</a> to view your file before downloading<br><br>
            Thanks,<br>
            Digital Transcoding Server<br>
            </body></html>");
    $this->email->to($RF->email);

    $this->email->send();
    echo "ok done";

Also my database is using utf8_general_ci. I also tried using a different text editor and same result.

Thoughts. Ideas?

Edited by SeanKann

2
Contributors
4
Replies
22
Views
2 Years
Discussion Span
Last Post by SeanKann
0

Hi, set the default charset for the web server to UTF-8, you can do this by adding this directive into your .htaccess file:

AddDefaultCharset utf-8

And be sure default_charset, in the php.ini file, is set correctly, otherwise set it dinamically:

ini_set('default_charset', 'UTF-8');
0

Tried both then re-sent the email same result.

htaccess

RewriteEngine on
RewriteCond $1 !^(index\.php|images|scripts|css|js|robots\.txt|favicon\.ico)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ ./index.php/$1 [L,QSA]  
AddDefaultCharset utf-8
1

Then check the contents of the debugger:

print_r($this->email->print_debugger());

You should be able to see the encoding, which is also visible looking at the headers of the received mail, but you should also be able to see if the connection to the SMTP server was done in UTF8 mode, for example:

250-8BITMIME
250-STARTTLS
250-ENHANCEDSTATUSCODES
250-PIPELINING
250-CHUNKING
250 SMTPUTF8                 <- this
0

Okay for some reason I think I found the issue. The issue is with my SMTP server.

cereal I found these differences and when I switched SMTP servers the encoding was working correctly.

current server has issues with encoding

hello: 250-smtp1.myserver.com
250-SIZE 20480000
250 AUTH LOGIN
from: 250 OK
to: 250 OK


old server that doesn't have encoding issues.
hello: 250-mail2.oldserver.ca
250-PIPELINING
250-SIZE 50000000
250-VRFY
250-ETRN
250-STARTTLS
250-ENHANCEDSTATUSCODES
250 8BITMIME

Edited by SeanKann

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.