|
|
|
Отправка письмо с Нужной кодировкой ( javamail )
|
|||
|---|---|---|---|
|
#18+
Вот есть пример из javamail -все работает, но русские буквы становяться кракозябрами, как поменять кодировку??? в примере что то говорится - но я чего то не догоняю... // If the desired charset is known, you can use // setText(text, charset) .... Message msg = new MimeMessage(session); msg.setFrom(new InternetAddress(from)); InternetAddress[] address = {new InternetAddress ("name1@yandex.ru")}; msg.setRecipients(Message.RecipientType.TO, address); msg.setSubject("JavaMail APIs Test"); msg.setSentDate(new Date()); // If the desired charset is known, you can use // setText(text, charset) msg.setText(msgText); Transport.send(msg); .... ... |
|||
|
:
Нравится:
Не нравится:
|
|||
| 19.05.2005, 12:56 |
|
||
|
Отправка письмо с Нужной кодировкой ( javamail )
|
|||
|---|---|---|---|
|
#18+
JavaMail javadoc public void setText(java.lang.String text, java.lang.String charset) throws MessagingException Convenience method that sets the given String as this part's content, with a MIME type of "text/plain" and the specified charset. The given Unicode string will be charset-encoded using the specified charset. The charset is also used to set the "charset" parameter. т.е. Код: plaintext 1. ... |
|||
|
:
Нравится:
Не нравится:
|
|||
| 19.05.2005, 13:00 |
|
||
|
Отправка письмо с Нужной кодировкой ( javamail )
|
|||
|---|---|---|---|
|
#18+
Java_userВот есть пример из javamail -все работает, но русские буквы становяться кракозябрами, как поменять кодировку??? в примере что то говорится - но я чего то не догоняю... // If the desired charset is known, you can use // setText(text, charset) .... Message msg = new MimeMessage(session); msg.setFrom(new InternetAddress(from)); InternetAddress[] address = {new InternetAddress ("name1@yandex.ru")}; msg.setRecipients(Message.RecipientType.TO, address); msg.setSubject("JavaMail APIs Test"); msg.setSentDate(new Date()); // If the desired charset is known, you can use // setText(text, charset) msg.setText(msgText); Transport.send(msg); .... Извините, туплю... у класса Message нет метода setText(String, String), но!!! у класса MimeMessage есть! :) Тема, закрыта ... |
|||
|
:
Нравится:
Не нравится:
|
|||
| 19.05.2005, 13:08 |
|
||
|
Отправка письмо с Нужной кодировкой ( javamail )
|
|||
|---|---|---|---|
|
#18+
XM JavaMail javadoc public void setText(java.lang.String text, java.lang.String charset) throws MessagingException Convenience method that sets the given String as this part's content, with a MIME type of "text/plain" and the specified charset. The given Unicode string will be charset-encoded using the specified charset. The charset is also used to set the "charset" parameter. т.е. Код: plaintext 1. Спасибо... ... |
|||
|
:
Нравится:
Не нравится:
|
|||
| 19.05.2005, 13:09 |
|
||
|
Отправка письмо с Нужной кодировкой ( javamail )
|
|||
|---|---|---|---|
|
#18+
XM JavaMail javadoc public void setText(java.lang.String text, java.lang.String charset) throws MessagingException Convenience method that sets the given String as this part's content, with a MIME type of "text/plain" and the specified charset. The given Unicode string will be charset-encoded using the specified charset. The charset is also used to set the "charset" parameter. т.е. Код: plaintext 1. Блин, еще не все как оказалось.... Отсылаю почту из оракла. ставлю кодировку и "UTF-8" и "koi8-r" - кракозябры, т.е. была проблемма когда я тестировал свой класс и отсылал сообщения из JBuilder, то после setText("тест", "koi8-r"); все стало нормально - русские буквы. Но когда я загрузил класс в оракл через create or replace and compile java source named mailutils as ... письма, несмотря на то что я явно указываю кодировку приходят кракозябрами, что может быть не так? При загрузке пакета mail.jar посредством loadjava были какие то ошибки, щас уже не скажу какие, но я попробовал - письма отсылаются, значит все ок ... |
|||
|
:
Нравится:
Не нравится:
|
|||
| 19.05.2005, 15:24 |
|
||
|
|

start [/forum/topic.php?fid=59&gotonew=1&tid=2152358]: |
0ms |
get settings: |
10ms |
get forum list: |
19ms |
check forum access: |
4ms |
check topic access: |
4ms |
track hit: |
150ms |
get topic data: |
12ms |
get first new msg: |
8ms |
get forum data: |
3ms |
get page messages: |
47ms |
get tp. blocked users: |
2ms |
| others: | 252ms |
| total: | 511ms |

| 0 / 0 |
