07-09-2013 02:58 AM
Hello I need some help. I write TCL script for IOS. Default script in ANSII coding format.
in script body I need use other language message:
append mail_pre "Subject: Информация\n\n"
And I receive mail with not readable value.
If I change coding for file like UTF-8 IOS get error, and not accept script.
Can I have way to use other language in tcl script?
Solved! Go to Solution.
08-16-2013 08:35 AM
Here is where you need additional headers to specify the MIME encoding. For example:
append mail_pre "MIME-Version: 1.0\r\n"
append mail_pre "Content-Type: text/plain; charset=\"UTF-8\"\r\n"
07-09-2013 08:12 AM
I don't think it's the encoding of the script that's the problem. I think you need to specify the encoding of the message in the SMTP envelope. Have a look at http://stackoverflow.com/questions/10752853/php-mailfrom-cyrrilic-encoding . This gives you an example of how to adjust the headers in general. You can do this same thing in Tcl by adding your headers after the default set of email headers.
For Base64 encoding, use ::base64::encode in EEM Tcl:
set b64 [::base64::encode $mySubject]
08-11-2013 08:10 AM
Hello Joseph, thonk you.
I try do construction like this:
set line_b64 [::base64::encode $line]
set mail_pre "Mailservername: user:pass@smtp.server.com\n"
append mail_pre "From: mail@domain.com\n"
append mail_pre "To: tomail@domain.com\n"
append mail_pre "Cc: from@domain.com\n"
append mail_pre "Subject:test\n"
append mail_pre "Date: $syslog_time_s\n"
append mail_pre "MIME Version: 1.0 \n"
append mail_pre "Content-Type: text/plain\n"
append mail_pre "Content-Transfer-Encoding: Base64\n"
append mail_pre "$line_b64\n"
set mail_msg [uplevel #0 [list subst -nobackslashes -nocommands $mail_pre]]
In email I see line in b64 no cirilic format.
08-11-2013 08:21 AM
You're not doing what the article says to do. I'm not sure what you're trying to accomplish here. If you want to have a subject with Cyrillic characters, do:
...
append mail_pre "Subject: =?UTF-8?B?[::base64::encode
Информация]?=\r\n"
...
08-16-2013 01:52 AM
Thank you Joseph. In my case if I use =?UTF-8?B?[::base64::encode Информация]?=\r\n"
It not work in Microsoft Outlook, but work on other (like iphone)
If i use WIN-1251 charset it fork fine in Outlook.
"Subject: =?windows-1251?B?[::base64::encode Информация]?=\r\n"
08-16-2013 02:15 AM
Can posable change charset for email body?
In subject all ok, in email body i have no readeble value.
I use construction now?
set mail_pre "Mailservername: user:pass@smtp.server.com\n"
append mail_pre "From: mail@domain.com\n"
append mail_pre "To: tomail@domain.com\n"
append mail_pre "Cc: from@domain.com\n"
append mail_pre "Subject: =?windows-1251?B?[::base64::encode Информация
]?=\r\n"append mail_pre "Date: $syslog_time_s\n"
append mail_pre "=?windows-1251?B?[::base64::encode Информация]?=\r\n"
set mail_msg [uplevel #0 [list subst -nobackslashes -nocommands $mail_pre]]
08-16-2013 08:35 AM
Here is where you need additional headers to specify the MIME encoding. For example:
append mail_pre "MIME-Version: 1.0\r\n"
append mail_pre "Content-Type: text/plain; charset=\"UTF-8\"\r\n"
08-17-2013 02:28 AM
Thank you Joseph.
Discover and save your favorite ideas. Come back to expert answers, step-by-step guides, recent topics, and more.
New here? Get started with these tips. How to use Community New member guide