Welcome Guest, Not a member yet? Register   Sign In
How to send international emails?
#1

[eluser]Benedikt[/eluser]
Hi,

Following problem:

I have my data from registred users written into a database in utf-8 format. Fine so far.

Now, after registration (international users) I want to send a confirmation mail. Now I face a few problems which I ask you for hints how to solve.

1) The hardcoded standard-reply is not utf-8 even I set utf-8 in email-config. If I use utf8_encode() its converted and shown correctly, but the database-data is wrong if I apply this function.

2) I want to put the content of the reply outside of my mailing-helper. An include fails. You think I should write the text to a database and solve utf-8 this way and hv shorter code?

Thanks for hints.
#2

[eluser]Crafter[/eluser]
There are two main things to do:
1. Ensure that the db is passing utf-8 data. I have done that by changing the database (mysql) .ini file on the server,
2. as well as passing the "SET NAME UTF-8" command to the db immediately after connection.
#3

[eluser]Benedikt[/eluser]
UTF8 in mysql is working fine.

I have a hardcoded mail-template in a mailing-helper I created. The text is kind of a template which is filled with data from the database.

Now I set the mail-encoding to utf-8 in the email.php in config-directory. The result is that the database-elements are encoded correctly, email is in utf-8 but the hardcoded text is not.

I tried to use the function utf8_encode() for the whole template but if you encode utf8-text to utf8 its also a mess.

So I guess I will put the template to the database and replace the values afterwards. This way it should be utf8.
#4

[eluser]Crafter[/eluser]
I've battled log and hard with utf-8 encoding, so I feel your pain.

Is your mail template a file. In that case, save it in UTF-8 format. You can do that with most decent editors. Otherwise use the iconv command (*Nix) to convert this.

(I've not used the utf8-encode() function, s can't help with this. )
#5

[eluser]Benedikt[/eluser]
I wanted to transform the template to an include-file but I cant figure out why it always results in an error when I try to include it in the helper. If u know how to do it, thanks for hints. In this case UTF8 could work even my editor should be utf8 already...

OFFTOPIC: Your codecrafter, is it stable enough for productive usage or is it just the starting point for a real administration-interface? I would use it as a user-backend.
#6

[eluser]Benedikt[/eluser]
fyi: I checked the encoding of the files again, the mailer was ANSI. Saved to UTF-8 ét voilà... Now works. Thanks.




Theme © iAndrew 2016 - Forum software by © MyBB