Encoding in e-mail
I am sending e-mail by SO_DOCUMENT_SEND_API1. E-mail encoding is
Content-Type: text/html; charset="ISO-8859-5"
And non-latin symbols (russian) are sent in wrong way:
<td>=C0=E3=E0=EB=E0=EA=EE=E2==E0 =C5=EB=E5=ED=E0</td>
I checked SAP codepage by SCP_GET_CODEPAGE_NUMBER, it says:
1500 - SAP-internal, like ISO 8859-5
hi try the following charset : windows-1251 and i think encoding : UTF-8 should be suitable
cheers
Similar Messages
-
Encoding conversion in Mail adapter
Hi,
we have a problem with the Mail adapter...
We try to send an email out of the XI to some service providers. The outgoing data is stored in an XML structure. This structure agrees with the conventions of the Mail Package format, which is used for dynamic Mail generation. The content of this Mail Package structure is a semicolon separated string, which should be attached as a CSV-File to the outgoing email. Up to this everything works fine. We get the email with the attachement out of the system, send it to a SMTP server and transfer it to a previous defined email address.
But when we open the attachement (with Wordpad, Excel,...) all german umlaut have been lost. The problem is, when transfering the Mail Package content into a File, this File is UTF-8 encoded.
Can anyone give us a hint how to convert the encoding of the attached file from UTF-8 to ISO-8859-1 (Latin-1)?
Actual we have set the following parameters on the module page:
Work sequence
1. localejbs/AF_Modules/MessageTransformBean Local Enterprise Bean XML2Plain
2. localejbs/sap.com/com.sap.aii.adapter.mail.app/XIMailAdapterBean Local Enterprise Bean mail
Modulconfiguration
XML2Plain Transform.ContentDisposition attachment;filename="ABC.csv"
XML2Plain Transform.ContentType text/plain;charset=latin-1
XML2Plain Transform.ContentDescription "ABC"
I hope we get some help...
Regards,
LarsHi,
Hi
We handled the similar requirement in our project.
To convert the target file encoding UTF-8 to ISO-8859-1. For this i have used XSLT mapping, by changing the output encoding as shown in the code.
<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:a="urn:abc.com:pi:ab:cd:FileToMail:Mail">
<xsl:variable name="vfileName" select="/a:MT_Mail/FileName"/>
<xsl:output method="text" indent="yes" encoding="iso-8859-1" media-type="TYP"/>
also set the charset value to ISO-8859-1 as shown in the XSLT mapping
<xsl:text>----mime-boundary
Content-Type: text/html; charset="ISO-8859-1"
Content-Disposition: inline
In Adapter module, add XMLAnonymizerBean
Link:http://help.sap.com/saphelp_nwpi71/helpdata/en/2e/bf37423cf7ab04e10000000a1550b0/frameset.htm
Hope this will resolve your issue.
Regards,
Divya
Edited by: Divya_10 on Jun 14, 2011 10:20 AM -
Accented characters not encoded properly in Mail since 10.6
Messages I type that contain accented or otherwise special characters appear fine as long as I'm typing them but get re-encoded in a way that is unreadable by recipients AND by me. I.e, if I go to my Sent folder and check such messages, all accented characters have become unreadable.
I don't remember ever having that problem with 10.5
It also does not seem to be a systematic issue. I think I have it more when answering to a message or when transferring a message, as if Mail used the encoding method of the initial sender.
Anyone else has this problem?The general approach at this time is to ask if you've checked for any problematic fonts (all languages) with Apple's Font Book (look in the Applications folder). Find and remove all duplicates also.
Start there to be sure all fonts that are in play come out with a clean bill of health.
Don't hesisate to perform wholesale deletion of old and/or little used fonts - be skeptical of anything that has come from Office 2008, including those related to an Equation Editor installation.
By all means be sure any 3rd party apps AND plug-ins are Snow Leopard compatible.
An additional measure is to clear the existing font caches:
http://www.macworld.com/article/139383/2009/03/fontcacheclear.html
That said, 10.6.2 release notes have this to say about fonts:
http://support.apple.com/kb/HT3874
Fonts fixes provided for:
• an issue with font spacing
• an issue in which some Fonts are missing
• font duplication issues
• an issue with some PostScript Type 1 fonts not working properly
Good luck in any case. -
The behaviour of encoding attachments in Mail.app
I used to compose plain text mails.
If I attach a file, for example:
blabla1<file>blabla2
Seems that Mail.app will encode them separately, blabla1, file and blabla2 will be encoded as 3 mime parts.
So in many mail clients (maybe including Outlook), my receipt will see the mail content blabla1, and 2 attachments: file and blabla2(this is a .txt file)
Even if I drag the file to the end of the text, in some mail client they will still see 2 attachment files.
How can I make Mail.app not to split the text? I just want my attachment at the end of the mail.OK, I've found the solution. In the attach file dialog there's a check box to use Windows compatible attachment files, check it and it's done
-
Receiver email encoding problem using mail package
Hi to all.
I'm facing a email problem. My company email server is workig fine with emails subject but customers email server is making some strange changes when i use special characters such as 'á' or spanish letter 'n with a tail on the top'.
I set the field 'Content_Type' of the email to 'text/plain; charset=ISO-8859-1' but isn't working. If i remove those special chars, the subject is OK.
I also tried to add content conversion in the receiver email adapter in module tab but with no possitive results.
I'm using SAP PI 7.0 sp14.
Any idea of what is happening?
Kind regards,
Inigo.If you want to use non-ascii characters in email subject, then you have to apply a special notation for this, like follows:
=?utf-8?Q?Auftragsbest=C3=A4tigung?=
This is email standard. So I recommend not use non-ascii characters in email subject.
Regards
Stefan -
Problem of encoding for mail sender adapter
Hello, everyone.
I have faced the problem of mail sender adapter.
When someone send message with any content encoding (even UTF-8) and 8bit content type encoding the XI mail adapter corrupt special and foreign symbols. I checked the message for correct structure and encoding with tpcgw utility and it was fine. For example (this is what I can see in tcpgw)
==== Response ====
+OK
+OK Password required for user itra_xi
+OK XXXXX maildrop has 1 messages (2048 octets)
+OK 1 2048
+OK
+OK 1459 octets
Return-path:
Received: from (port=20091 helo=XXXX)
by mx76.mail.ru with psmtp
id 1O7UoW-0003I4-00
for XXXXXX; Thu, 29 Apr 2010 18:34:04 +0400
Message-ID:
Subject: Message 29 4
Date: Thu, 29 Apr 2010 17:33:43 +0300
MIME-Version: 1.0
Content-Type: multipart/alternative;
boundary="----=_NextPart_000_0018_01CAE7C2.1D0BBA60"
X-Priority: 3
X-MSMail-Priority: Normal
X-Mailer: Microsoft Outlook Express 6.00.2900.5843
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.5579
X-Spam: Not detected
X-Mras: Ok
This is a multi-part message in MIME format.
=_NextPart_000_0018_01CAE7C2.1D0BBA60
Content-Type: text/plain;
charset="utf-8"
Content-Transfer-Encoding: 8bit
Test
Тест
And after processing by XI mail adapter I have this payload (XIPAYLOAD mode using mail package)
Test
Тест
The same situation with using mail package in xml document.
Any suggestions how this can be corrected?I switched UTF-8 encoding during displaying of http content in tcpgw utility and all other mail clients detect it as UTF-8 and work fine. Also this problem occurs with different mail clients that are senders of the message. So it seems adapter takes each byte of cyrillic symbol (each from two) and represents it as individual symbol.
Correct me if I'm wrong. Maybe there is some configuration somewhere allowing to correct or maybe it's possible to write module to correct.. but it's quite complicated to split correct and incorrect symbols. -
Issues with Japanese encoding using Mail
Since recently (I would say since I updated to 10.6), I have an issue with Japanese-encoded (ISO 2022-JP) mails on my English MacOS.
I have no problem to read, edit and write answers to any mails.
However with some ISO JP-2022-JP encoded messages (sent with Thunderbird 2.0.0.23 (Windows/20090812) btw) I have the following misbehaviour:
- if I send the message and let the encoding to "automatic", Mail sends the mail in UTF-8, which I do not want since most of Japanese computer do not understand UTF-8 by default (and the receiver gets panicked: "I can not read your mail T_T !")
- if I set the encoding to "ISO JP-2022-JP", I can not send nor save the message (see [1] at the end of the post). One should note that the error message when saving is really misleading (and yes my hard-drive has a lot of space left) and it should be fixed by Apple.
- if I dig a bit deeper, I can in effect find some characters in the original message which prevent Mail to send my mail. It however does not make any sense since:
- those char were in the original message properly encoded in ISO JP-2022-JP
- those char are always very common ones
The only solution I have found so far is to delete the original message in my mail, which is very frustrating...
A sample of such mail can be found at (I removed personal info. and the mail is about a drinking party):
- http://files.me.com/trouve.antoine/73w3w9
Help would be very appreciated.
Thank you very much.
Antoine
[1] I get the following error messages:
-> try to save:
*This message can’t be saved to the Drafts mailbox.*
The message contains one or more attachments that
are too large to be saved in the Drafts mailbox. Try
deleting some attachments.
->try to send
*Invalid Text Encoding*
Some characters in your message could not be
converted to the “Japanese (ISO 2022-JP)” text
encoding. Choose a different encoding from the
“Text Encoding” menu.You can find out about the different versions here, for example:
http://en.wikipedia.org/wiki/ISO/IEC_2022
Thank you. I feel a bit stupid for not having looked in Wikipedia at first...
I sometime wonder how could such basic problem like charset not being solved after more than 40 years of computer science...
Here is a note that addresses that problem, but I don't think it works with 10.6. Might be worth a > try:
http://discussions.apple.com/thread.jspa?threadID=121808&tstart=60
Thank for the link.
It seems to still work: new japanese mails are now sent in "ISO 2022-JP-2".
However, for messages with the header explicitly specifying "ISO 2022-JP" (which should be "ISO 2022-JP-2" on my mac) it has no influence.
The only ways I see to solve this issue would be:
i) to force "ISO 2022-JP-2" for all mails (a bit too extreme)
ii) to force the use of "ISO 2022-JP-2" instead of "ISO 2022-JP", but I do not think such precise configuration is possible
This mess appears to be due to Thunderbird which seems to mix "ISO 2022-JP-2" and "ISO 2022-JP", but I do not have any working Thunderbird to test now... -
Bug with Cyrillic-UTF-8 encoding in Outlook messages sent from iphone
Some time, during replay or forwarding mails, written in Cyrillic form iPhone3GS (iOS 4.0), iPhone send a format of the message UTF-8 and did not field the charset field.
In such case most of the windows client(Outlook, The BAT, Firefox) cannot recognize the message encoding automatically. Advanced clients have to use manual setting of the encoding.
In older iOS in iPhone2G i have't met such problemtry this
-----------------------------------------------message I send:
Return-Path: <[email protected]>
Received: from FS011 ([10.10.10.11])
(authenticated user [email protected])
by mail.xxx.ru
for [email protected];
Wed, 28 Jul 2010 12:54:53 +0400
Message-ID: <12ED165C69BD4E59B70551BC5AF7A0F4@FS011>
From: =?koi8-r?B?8MXexc7Lyc4g88XSx8XK?= <[email protected]>
To: <[email protected]>
Subject: TEST
Date: Wed, 28 Jul 2010 12:54:49 +0400
MIME-Version: 1.0
Content-Type: multipart/alternative;
boundary="----=NextPart_000_043C01CB2E54.10472660"
X-Priority: 3
X-MSMail-Priority: Normal
X-Mailer: Microsoft Windows Mail 6.0.6001.18000
X-MimeOLE: Produced By Microsoft MimeOLE V6.0.6001.18049
Sender: <support-owner@xxx>
List: <[email protected]>
List-Help: <mailto:[email protected]>
List-Post: <mailto:[email protected]>
List-Subscribe: <mailto:[email protected]>
List-Owner: <mailto:[email protected]>
List-Id: <support.xxx.ru>
List-Unsubscribe: <mailto:[email protected]>
Errors-to: <[email protected]>
X-BeenThere: <[email protected]>
Precedence: list
This is a multi-part message in MIME format.
------=NextPart_000_043C01CB2E54.10472660
Content-Type: text/plain;
charset="koi8-r"
Content-Transfer-Encoding: quoted-printable
=F3 =D5=D7=C1=D6=C5=CE=C9=C5=CD
=F2=D5=CB=CF=D7=CF=C4=C9=D4=C5=CC=D8 IT =CF=D4=C4=C5=CC=C1
------=NextPart_000_043C01CB2E54.10472660
Content-Type: text/html;
charset="koi8-r"
Content-Transfer-Encoding: quoted-printable
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=3DContent-Type content=3D"text/html; charset=3Dkoi8-r">
<META content=3D"MSHTML 6.00.6001.18183" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=3D#ffffff>
<DL>
<DT>------------------------------------------</DT>
<DT>=F3 =D5=D7=C1=D6=C5=CE=C9=C5=CD</DT>
<DT>=F2=D5=CB=CF=D7=CF=C4=C9=D4=C5=CC=D8 IT =
<SPAN=20
lang=3Dru-RU>=CF=D4=C4=C5=CC=C1</DT>
<DT>=EF=EF=EF «=E6=C9=D2=CD=C5=CE=CE=D9=CA =
=D3=C1=CC=CF=CE»</DT>
<DT>=F0=C5=DE=C5=CE=CB=C9=CE =F3=C5=D2=C7=C5=CA</DT>
<DD><FONT face=3DArial =
size=3D2>
</DD></DL></BODY></HTML>
------=NextPart_000_043C01CB2E54.10472660--
-------------------------------------------- message from iphone
Return-Path: <[email protected]>
X-Envelope-To: [email protected]
Received: from [192.168.0.82] ([10.10.10.10])
(authenticated user [email protected])
by mail.xxx.ru
for [email protected];
Wed, 28 Jul 2010 13:00:27 +0400
Message-Id: <[email protected]>
From: =?koi8-r?B?8MXexc7Lyc4g88XSx8XK?= <[email protected]>
To: =?koi8-r?B?8MXexc7Lyc4g88XSx8XK?= <[email protected]>
In-Reply-To: <12ED165C69BD4E59B70551BC5AF7A0F4@FS011>
Content-Type: multipart/alternative;
boundary=Apple-Mail-1--794833101
Content-Transfer-Encoding: 7bit
X-Mailer: iPhone Mail (7D11)
Mime-Version: 1.0 (iPhone Mail 7D11)
Subject: Re: TEST
Date: Wed, 28 Jul 2010 12:59:18 +0400
References: <12ED165C69BD4E59B70551BC5AF7A0F4@FS011>
--Apple-Mail-1--794833101
Content-Type: text/plain;
charset=windows-1251;
format=flowed;
delsp=yes
Content-Transfer-Encoding: quoted-printable
=CE=EA
=D1 =D3=E2=E0=E6=E5=ED=E8=E5=EC
=D1=E5=F0=E3=E5=E9
28.07.2010, =E2 12:54, =CF=E5=F7=E5=ED=EA=E8=ED =D1=E5=F0=E3=E5=E9 =
<[email protected]> =ED=E0=EF=E8=F1=E0=EB=20
(=E0):
=D1 =F3=E2=E0=E6=E5=ED=E8=E5=EC
=D0=F3=EA=EE=E2=EE=E4=E8=F2=E5=EB=FC IT =EE=F2=E4=E5=EB=E0
--Apple-Mail-1--794833101
Content-Type: text/html;
charset=utf-8
Content-Transfer-Encoding: quoted-printable
<html><body bgcolor=3D"#FFFFFF">=D0=9E=D0=BA
------------=
=D0=A1 =
=D0=A3=D0=B2=D0=B0=D0=B6=D0=B5=D0=BD=D0=B8=D0=B5=D0=BC
=D0=A1=D0=
=B5=D1=80=D0=B3=D0=B5=D0=B9
28.07.2010, =D0=B2 =
12:54, =D0=9F=D0=B5=D1=87=D0=B5=D0=BD=D0=BA=D0=B8=D0=BD =D0=A1=D0=B5=D1=80=
=D0=B3=D0=B5=D0=B9 <<a =
href=3D"mailto:[email protected]">[email protected]> =
=D0=BD=D0=B0=D0=BF=D0=B8=D1=81=D0=B0=D0=BB(=D0=B0):
</di=
v>
<dl>
<dt>------------------------------------------</dt>
<dt>=D0=A1 =D1=83=D0=B2=D0=B0=D0=B6=D0=B5=D0=BD=D0=B8=D0=B5=D0=BC</dt>
<dt>=D0=A0=D1=83=D0=BA=D0=BE=D0=B2=D0=BE=D0=B4=D0=B8=D1=82=D0=B5=D0=BB=D1=
=8C IT <span =
lang=3D"ru-RU">=D0=BE=D1=82=D0=B4=D0=B5=D0=BB=D0=B0</dt>
<dt>=D0=9E=D0=9E=D0=9E =C2=AB=D0=A4=D0=B8=D1=80=D0=BC=D0=B5=D0=BD=D0=BD=D1=
=8B=D0=B9 =D1=81=D0=B0=D0=BB=D0=BE=D0=BD=C2=BB</dt>
<dt>=D0=9F=D0=B5=D1=87=D0=B5=D0=BD=D0=BA=D0=B8=D0=BD =D0=A1=D0=B5=D1=80=D0=
=B3=D0=B5=D0=B9</dt>
<dd>
</dd></dl>
</body></html>=
--Apple-Mail-1--794833101-- -
Mail adapter module UTF-8 to ISO-8859-1 conversion
Hi!
I've a problem with a mail attachment which is generated by an adapter module for the mail adapter. The content type is set to "Application/EDIFACT; charset=iso-8859-1" when I add the attachment, but the mail adapter ignores the charset-setting.
Therefore german "umlauts" like ü are displayed in a wrong way: ü
When I set the content, I transform it in ISO-8859-1 : attachment.setContent(edifactString.getBytes("ISO-8859-1"),"ISO-8859-1");
When I test the result of edifactString.getBytes("ISO-8859-1"), I get the String in the right character encoding, but the mail adapter seems to "fix" the encoding
I also tried to use the messageTransformBean, but it doesn't worked.
Anyone knows how to solve this issue?
Best regards,
DanielHi all!
I found a solution for this problem: First I used the TextPayload-Object for the Attachment which should be added. It seems that the TextPayload-Object has some bugs handling different encodings (handels only Unicode and deletes the charset=... setting from the ContentType).
When using the Payload object for the attachment (which handles binary data), there is no conversion to Unicode, so I get my attachment as desired (but still without the charset-setting).
Best regards,
Daniel -
Email attachment content corrupted, Encoding Issue
Hi all, I have problem with corrupted email attachments.
I write JSP codes to send the html file I have created as an ATTACHMENT by using codes:
messageBodyPart = new MimeBodyPart();
FileDataSource fds = new FileDataSource(tempAttachment);
messageBodyPart.setDataHandler(new DataHandler(fds));
messageBodyPart.setFileName(filename);
multipart.addBodyPart(messageBodyPart);
I can successfully send out an email with attachment, however, the attachment when received by Outlook Express, Gmail, Thunderbird are fine without any corruption, but it was corrupted when received with my Outlook 2000. It is totally corrupted and cannot be converted even I change any encodings to view it. Please find below the corrupted text for your reference:
[email protected]& @{83;g@Z8i 1MGO 6G4B 1MGO@G ?)G` 0hH94c4g@Z0! ?9>`GR 6' A$H.GQ <:8m 9W ?y5eF\=: 9xH#8& >K7AAV=C1b 9Y6x4O4Y.
I found many resources to help people to do encoding for the mail subject and attachment file name, but coundn't find any for the encoding of the attachment content, many authors even suggest that the email client will do the job for attachment encoding conversion. But, Outlook 2000 sucks, I need to do it explicitly in the coding, would anyone of you help me?
Thanks a lot for your help and this is urgent, your help is highly appreciated.Hey, where are the experts?Maybe the JavaMail experts view the JavaMail forum!
>
OMG, people in this forum only know how to get stuff
from the others and never thinking of sharing your
knowledge with the others?This is just stupid! If nobody is "sharing your knowledge" then how can others "get stuff"?
>
Or there are no experts in this forum???Plenty! Many have written well thought of books on various Java topics.
I am not an expert in JavaMail but I use JavaMail and have sent JavaMail with attachments to Outlook 2000 but I have never seen your problem. Don't you think it significant that all woks OK except on Outlook 2000! Maybe printing the raw email will help you decide what is wrong.
P.S. Consider moving the code that sends the email out fo the JSP to a class that can be tested outside the web server. Then if you have a problem you can post more than just a fragment. -
Cannot read some HTML mail sent
I have an issue where certain messages are showing up as blank in mail, no matter what I do. The only way to read them is for me to log onto my web based e-mail service, and read them there, using Safari, where they show up fine. Is there any way to fix this? I need to be able to save those messages locally, and it't a pain to have to log on and convert each one to a pdf vice just moving the mail into a local folder in mail.
I have mail set to display html messages, and 95% seem to display just fine, but a few (strangely they tend to be the important ones like hotel reservation confirmations) just appear as blank white screens.
I confess to being ignorant of the underlying mechanics of the messages, so if any more info would help, ask and I will supply what I can.
Thanks,
WayneThere are about 7 messages in that account inbox (changes a bit, but that is the average of what I keep in there, the max is about 40 on any given day before I go through it).
I actually have had a lot of problems with mail hanging up and having eternal "updating mail cache" issues, so I have rebuilt all my accounts several times, most recently earlier this week, with no resolution to this issue. I have also gone into the library/mail directory and deleted the inbox files for all my accounts and rebuilt the next time I used mail.
Just in case it helps, here is the raw source view from one of the messages in question.
Received: from cmsmail05.cms.usa.net [127.0.0.1] by cmsmail05.cms.usa.net via mtad (C8.MAIN.3.27E)
with ESMTP id 844kBuVCe0208M05; Tue, 21 Feb 2006 21:28:04 GMT
Return-Path: <[email protected]>
Received: from pwhome.com [24.155.140.27] by cmsmail05.cms.usa.net via smtad (C8.MAIN.3.27I);
Tue, 21 Feb 2006 21:28:04 GMT
X-USANET-Source: 24.155.140.27 IN [email protected] pwhome.com
X-USANET-MsgId: XID421kBuVCe9984X05
Received: from ALEX (172.16.0.1:1352)
by pwhome.com with [XMail 1.18 (Win32/Ix86) ESMTP Server]
id <S569E37> for <[email protected]> from <[email protected]>;
Tue, 21 Feb 2006 15:30:48 -0600
From: "Alex Balic" <[email protected]>
To: "'Wayne Labat'" <[email protected]>
Subject: RE: Receipt for Your Payment to [email protected]
Date: Tue, 21 Feb 2006 15:27:59 -0600
Message-ID: <002401c6372d$b0d6a1f0$6f01a8c0@ALEX>
MIME-Version: 1.0
Content-Type: text/plain;
charset="us-ascii"
Content-Transfer-Encoding: 7bit
X-Mailer: Microsoft Office Outlook 11
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2180
In-Reply-To: <[email protected]>
Thread-Index: AcY3KsktLCW0as7HT+qEwALk1H1w9gAAq03Q
X-Ciphire-Report: plain
------------------------------------------------------ -
my code is a very normal retrieve mail from the sample demo from javamail 1.4....
i have trouble to retrieve 7 bit mail...
pls provide me a solution.....
Message from yahoo.com.
Unable to deliver message to the following address(es).
<[email protected]>:
This user doesn't have a yahoo.com account ([email protected]) [0]
<[email protected]>:
This user doesn't have a yahoo.com account ([email protected]) [0]
--- Original message follows.
X-Originating-IP: [202.190.203.15]
Return-Path: <[email protected]>
Authentication-Results: mta307.mail.mud.yahoo.com from=emi-solutions.biz; domainkeys=neutral (no sig)
Received: from 202.190.203.15 (EHLO emg-mrk04.localdns.com) (202.190.203.15)
by mta307.mail.mud.yahoo.com with SMTP; Tue, 10 Apr 2007 18:51:44 -0700
Received: from emi-sap ([218.208.222.212])
by emg-mrk04.localdns.com (@Net Mail v3.60a) with ASMTP id QFK76541;
Wed, 11 Apr 2007 09:51:41 +0800
Message-ID: <26960868.1176256269906.JavaMail.SAPServiceN01@emi-sap>
Date: Wed, 11 Apr 2007 09:51:09 +0800 (SGT)
From: [email protected]
To: [email protected], [email protected]
Subject: 2 mail same host yahoo
Mime-Version: 1.0
Content-Type: text/plain
Content-Transfer-Encoding: 7bit
2 mail same host yahoo
*** MESSAGE TRUNCATED ***
public void dumpPart(Part p, PrintWriter out, InMailBean inMailBean, Collection detailCol,InvalidMailAck invalidMailAck) throws Exception {
Util util = new Util();
InMailDetailsBean inMailDetailsBean = new InMailDetailsBean();
System.err.println("In dumpPart");
if (p instanceof Message)
dumpEnvelope((Message)p, out, inMailBean,invalidMailAck);
/** Dump input stream ..
InputStream is = p.getInputStream();
// If "is" is not already buffered, wrap a BufferedInputStream
// around it.
if (!(is instanceof BufferedInputStream))
is = new BufferedInputStream(is);
int c;
while ((c = is.read()) != -1)
System.out.write(c);
String ct = p.getContentType();
try {
//out.println("<P>" + "CONTENT-TYPE: " + (new ContentType(p.getContentType())).toString()+ "</P>");
out.println("<P>" + "CONTENT-TYPE: " + (new ContentType(ct)).toString()+ "</P>");
} catch (ParseException pex) {
//System.err.println("BAD CONTENT-TYPE: " + p.getContentType());
System.err.println("BAD CONTENT-TYPE: " + ct);
String filename = p.getFileName();
if (filename != null){
out.println("<P>" + "FILENAME:" + filename + "</P>");
System.err.println("FILENAME: " + filename);
inMailDetailsBean.setAttachmentId(util.getUniqueId());
inMailDetailsBean.setEmailId(inMailBean.getEmailId());
inMailDetailsBean.setAttachmentName(getNewFileName(filename));
* Using isMimeType to determine the content type avoids
* fetching the actual content data until we need it.
if (p.isMimeType("text/plain")) {
System.err.println("**** plain text ****");
out.println("<P>" + "This is plain text"+ "</P>");
out.println("<P>" + "---------------------------"+ "</P>");
//if (!showStructure && !saveAttachments)
String strContent=(String)p.getContent();
System.err.println("strContent :" +strContent);
out.println("<P>" + strContent + "</P>");
String newContent=replace(strContent);
System.err.println("newContent:" +newContent);
out.println("<P>" + newContent + "</P>");
String[] arrResult=parseMailAddress(strContent);
String strInvalidAdd="";
for(int i=0;i<arrResult.length;i++){
out.println("<p> Invalid Address :<b>" +arrResult.toString() +"</b></p>");
System.err.println("InvAdd:" +arrResult[i].toString());
strInvalidAdd+=arrResult[i].toString();
System.err.println("strInvalidAdd: " +strInvalidAdd);
System.err.println("strInvalidAdd 2: " +strInvalidAdd);
invalidMailAck.setInvalidAddress(strInvalidAdd);
arrInvalidMail.add(invalidMailAck); //after dump envelope that add sender subject , we add invalid address
System.err.println("Invalid address:" +strInvalidAdd);
//out.println("<P>" + (String)p.getContent() + "</P>"); //added by won to eliminate <> () from invalid address
//added by won
//start
Object o = p.getContent();
if (o instanceof String) {
String str = (String)o;
inMailBean.setMessage(str.getBytes());
out.println("<P>" + "This is a string"+ "</P>");
out.println("<P>" + "---------------------------"+ "</P>");
out.println("<P>" + str + "</P>"); //added by won to eliminate <> () from invalid address
}else{
String str="";
inMailBean.setMessage(str.getBytes());
//end
}else if(p.isMimeType("multipart/report")){ //p.isMimeType("multipart/report") ||p.isMimeType("message/delivery-status");
deliveryStatusFailed=true;
//add by won to handle delivery status
System.err.println("This is a Multipart Report");
System.err.println("---------------------------");
out.println("<p>" +"This is a Multipart Report"+"<p>");
out.println("<p>" +"---------------------------"+"<p>");
System.err.println("content type:" +p.getContentType());
Multipart mp = (Multipart)p.getContent();
level++;
System.err.println("before level:" + level);
int count = mp.getCount();
System.err.println("count:" + count);
for (int i = 0; i < count; i++)
//*************commented out by won ****************************************************
dumpPart(mp.getBodyPart(i), out, inMailBean, detailCol,invalidMailAck);
//dumpPart2(mp.getBodyPart(i), out, inMailBean, detailCol);
level--;
System.err.println("after level:" + level);
Object o=p.getContent();
if(o instanceof MultipartReport){
MultipartReport mr = (MultipartReport)p.getContent();
System.err.println("cast multipart/report");
level++;
System.err.println("Report Text");
try {
String t = mr.getText();
if (t == null)
System.err.println("NULL");
//else if (showStructure)
// System.err.println("Size: " + t.length());
else
System.err.println(t);
} catch (MessagingException ex) {
System.err.println(ex.toString());
System.err.println("Delivery Status");
DeliveryStatus ds = mr.getDeliveryStatus();
if (ds == null)
System.err.println("NULL");
else
System.err.println(ds.toString());
MimeMessage rm = mr.getReturnedMessage();
if (rm != null) {
if (rm instanceof MessageHeaders) {
System.err.println("Returned Message Headers");
System.err.println("---------------------------");
level++;
System.err.println("before level:" + level);
dumpEnvelope(rm,out, inMailBean,invalidMailAck);
level--;
} else {
System.err.println("Returned Message");
System.err.println("---------------------------");
level++;
dumpPart(rm,out, inMailBean, detailCol,invalidMailAck);
//dumpPart(rm);
level--;
level--;
}else{
System.err.println("content type:" +p.getContentType());
} else if (p.isMimeType("multipart/*")) {
System.err.println("**** multipart ****");
out.println("<P>" + "This is a Multipart"+ "</P>");
out.println("<P>" + "---------------------------"+ "</P>");
Multipart mp = (Multipart)p.getContent();
level++;
System.err.println("before level:" + level);
int count = mp.getCount();
System.err.println("count:" + count);
for (int i = 0; i < count; i++)
dumpPart(mp.getBodyPart(i), out, inMailBean, detailCol,invalidMailAck);
level--;
System.err.println("after level:" + level);
} else if (p.isMimeType("message/rfc822")) {
System.err.println("**** Nested Message ****");
out.println("<P>" + "This is a Nested Message"+ "</P>");
out.println("<P>" + "---------------------------"+ "</P>");
level++;
System.err.println("before level:" + level);
dumpPart((Part)p.getContent(), out, inMailBean, detailCol,invalidMailAck);
level--;
System.err.println("after level:" + level);
}else {
//if (!showStructure && !saveAttachments) {
* If we actually want to see the data, and it's not a
* MIME type we know, fetch it and check its Java type.
Object o = p.getContent();
if (o instanceof String) {
String str = (String)o;
inMailBean.setMessage(str.getBytes());
out.println("<P>" + "This is a string"+ "</P>");
out.println("<P>" + "---------------------------"+ "</P>");
out.println("<P>" + str + "</P>");
} else if (o instanceof InputStream) {
//remark out by won
//inMailBean.setMessage(convertInputStreamToByteArray((InputStream)o));
out.println("<P>" + "This is just an input stream"+ "</P>");
out.println("<P>" + "---------------------------"+ "</P>");
// InputStream is = (InputStream)o;
// int c;
// while ((c = is.read()) != -1)
// out.write(c);
} else {
//remark out by won
//inMailBean.setMessage(o.toString().getBytes());
out.println("<P>" + "This is an unknown type"+ "</P>");
out.println("<P>" + "---------------------------"+ "</P>");
//out.println("<P>" + o.toString()+ "</P>");
* If we're saving attachments, write out anything that
* looks like an attachment into an appropriately named
* file. Don't overwrite existing files to prevent
* mistakes.
InputStream is = null;
if (saveAttachments && level != 0 && !p.isMimeType("multipart/*")) {
String disp = p.getDisposition();
// many mailers don't include a Content-Disposition
if (disp == null || disp.equalsIgnoreCase(Part.ATTACHMENT)) {
if (filename == null){
filename = "Attachment" + attnum++;
System.err.println("Saving attachment to file " + filename);
}else{
try {
File f = new File(filename);
//if (f.exists()){
// XXX - could try a series of names
// throw new IOException("file exists");
is = ((MimeBodyPart)p).getInputStream();
//TODO save f to the blob
//byte[] fileBytes = new byte[is.available()];
// Read in the bytes
//int offset = 0;
//int numRead = 0;
//while ( (offset < fileBytes.length)&&((numRead=is.read(fileBytes, offset, fileBytes.length-offset)) >= 0) ) {
// offset += numRead;
// if(f.length()>0){
// fileBytes = new byte[(int)f.length()];
// }else{
// fileBytes = new byte[]{1};
inMailDetailsBean.setAttachment(convertInputStreamToByteArray(is));
detailCol.add(inMailDetailsBean);
} catch (IOException ex) {
System.err.println("Failed to save attachment: " + ex);
System.err.println("------------------------------------------");
public void dumpEnvelope(Message m, PrintWriter out, InMailBean inMailBean,InvalidMailAck invalidMailAck) throws Exception {
Util util = new Util();
System.err.println("In dumpEnvelope");
out.println("<P>" + "This is the message envelope"+ "</P>");
out.println("<P>" + "---------------------------"+ "</P>");
Address[] a;
// FROM
if ((a = m.getFrom()) != null) {
for (int j = 0; j < a.length; j++){
out.println("<P>" + "FROM:<b> " + a[j].toString()+ "</b></P>");
inMailBean.setSender(a[j].toString().trim());
invalidMailAck.setSender(a[j].toString().trim());
// TO
if ((a = m.getRecipients(Message.RecipientType.TO)) != null) {
for (int j = 0; j < a.length; j++) {
out.println("<P>" + "TO:<b> " + a[j].toString()+ "</b></P>");
//inMailBean.setReceipient(a[j].toString()); //TODO getting fr configuration
/* InternetAddress ia = (InternetAddress)a[j];
if (ia.isGroup()) {
InternetAddress[] aa = ia.getGroup(false);
for (int k = 0; k < aa.length; k++)
System.err.println(" GROUP: " + aa[k].toString());
// SUBJECT
out.println("<P>" + "SUBJECT:<b> " + m.getSubject()+ "</b></P>");
inMailBean.setSubject(m.getSubject().trim());
invalidMailAck.setSubject(m.getSubject().trim());
out.println("<P>" + "Desc: " + m.getDescription()+ "</P>");
//out.println("<P>" + "Header: " + m.getHeader("Disposition-Notification-To").toString()+ "</P>");
// DATE
Date d = m.getSentDate();
inMailBean.setDateReceive(util.convertDateToStringFormat(d));
inMailBean.setDateIn(util.convertDateToStringFormat(new Date()));
inMailBean.setDateAck(inMailBean.getDateIn());
//if(deliveryStatusFailed==true){
// inMailBean.setAckDelivery(util.getNotAckDelivery());
//}else{
// inMailBean.setAckDelivery(util.getAckDelivery());
inMailBean.setAckDelivery(util.getAckDelivery());
inMailBean.setTimeReceive(util.convertStringToLongDateFormat(inMailBean.getDateReceive()));
inMailBean.setTimeIn(util.convertStringToLongDateFormat(inMailBean.getDateIn()));
inMailBean.setTimeAck(inMailBean.getTimeIn());
//out.println("<P>" + "SendDate: " +(d != null ? util.convertDateToStringFormat(d) : "UNKNOWN")+ "</P>");
out.println("<P>" + "SendDate: " +(d != null ? d.toString() : "UNKNOWN")+ "</P>");
// FLAGS
Flags flags = m.getFlags();
StringBuffer sb = new StringBuffer();
Flags.Flag[] sf = flags.getSystemFlags(); // get the system flags
boolean first = true;
for (int i = 0; i < sf.length; i++) { //check the message flag
String s;
Flags.Flag f = sf[i];
if (f == Flags.Flag.ANSWERED)
s = "\\Answered";
else if (f == Flags.Flag.DELETED)
s = "\\Deleted";
else if (f == Flags.Flag.DRAFT)
s = "\\Draft";
else if (f == Flags.Flag.FLAGGED)
s = "\\Flagged";
else if (f == Flags.Flag.RECENT)
s = "\\Recent";
else if (f == Flags.Flag.SEEN)
s = "\\Seen";
else
continue; // skip it
if (first)
first = false;
else
sb.append(' ');
sb.append(s);
String[] uf = flags.getUserFlags(); // get the user flag strings
for (int i = 0; i < uf.length; i++) {
if (first)
first = false;
else
sb.append(' ');
sb.append(uf[i]);
out.println("<P>" + "FLAGS: " + sb.toString()+ "</P>");
// X-MAILER
String[] hdrs = m.getHeader("X-Mailer");
if (hdrs != null)
out.println("<P>" +"X-Mailer: " + hdrs[0]+ "</P>");
else
out.println("<P>" +"X-Mailer NOT available"+ "</P>");
Message was edited by:
yzmewonYou have an awfully large amount of code there. Often it is a good idea to write a small program to test out some feature you are having a problem with. Then when you have it working, incorporate the correct code into your large program.
Besides, people will not read large badly-formatted programs here anyway. -
RFC - XI - Mail scenario special characters
Hi Experts,
I'm developing the mentioned scenario and have one problem.
In my scenario I have one transformation RFC -> XML that uses graphical mapping one second transformation XML -> Mail package that is a java mapping where I take one of the fields of the XML, and pack all XML in the Content field.
The process works, but when in the XML I have one text data and it has one special character(in spanish á, é, í, ñ...), the payload and the mail that is sent reflects those characters as ��. For example if the data is 'dirección', in the mail sent appears 'direcci��n'
Best Regards.
Alfredo Lagunar.Hola Alfredo,
In deed you have a character encoding mismatch.
The encoding the browser is expecting and the encoding of your mail message must match or you will see those strange characters instead of á, é, etc.
So you either change your browser's default encoding (Internet explorer: view->character encoding) or you indicate in the Mail package the type of content and the encoding you are using so your browser or email program knows what is the correct encoding.
You see the error in SXMB_MONI because it uses embedded browser windows to display the XML messages.
To fix it you have to put the following string: "text/html; charset=utf-8"
into the field Content_Type of the Mail package in the message mapping you use to generate the email.
If you are using XIALL in message protocol instead of Mail package (XIPAYLOAD) you have to add the message transform bean (MTB) to the Mail adapter modules. Using the MTB add the Transform.ContentType parameter with the same string as above.
You can see how to configure the MTB in the sap online documentation: http://help.sap.com/saphelp_nw70/helpdata/en/57/0b2c4142aef623e10000000a155106/frameset.htm
Hope it helps...
Saludos!
-Sam. -
Groups within groups broken in Mavericks Mail?
In Mavericks 10.9, it appears there's a problem if a Contacts group contains other Contacts groups.
Example:
Within Contacts, create Small Group with three contacts.
Within Contacts, create Big Group with six contacts.
Within Contacts, create Huge Group.
Drag Small Group and Big Group to Huge Group.
In Contacts, click on Huge Group. It appears to contain Small Group and Big Group.
Click on either Small Group or Big Group and Contacts reports "No Cards".
Open Mail.
Make a New Message.
In the To: field type "Huge Group".
No addresses appear.
In Contacts, a control-click on Huge Group shows a pop-up menu with command Send Email to "Huge Group" dimmed.
Is this happening to others?
mmWhat does it say in the "charset=" header
charset="iso-8859-1"
But another mail has nothing there, only "Content-Type: text/html";
The important thing is not whether this charset is correct or not. The important thing is that Apple has made my mail experience worse by this "upgrade", for no good reason!
Earlier, I could change encoding of mails (perhaps a badly encoded mail), but Apple has taken away that posibility for no good reason. It only affects old mails, before UTF became common. It is typical of Apple not to care about history, but for me, old mails constitute valuable history.
Rather than taking away an option to change the encoding (or interpretation of an encoding) of a mail, I think Apple should have enhanced the feature: Sometimes, it happens that only the subject line is erronously interpretated (mime endoding of non-us-ascii characters), and I would like to fix that. It has never been possible. (This problem can even happen today with some new mails auto-generated by machines, such as auto-replies.) -
Transfer-Encoding is set depending on server
Hi everyone!
I have a serious problem concerning message encoding on different machines. On my development machine (running WinXP) I can send email messages perfectly with this code:
MimeMessagePreparator pwMessagePreparator = new MimeMessagePreparator() {
public void prepare(MimeMessage mimeMessage) throws MessagingException {
mimeMessage.setHeader("Content-Transfer-Encoding", "8bit");
MimeMessageHelper message = new MimeMessageHelper(mimeMessage, false, "ISO-8859-1");
message.setSubject("Engineering-Days - Neues Passwort");
message.setTo(address);
String messageText = "Hallo!\n\n" +
"Dein Passwort wurde neu gesetzt. Es lautet jetzt: " + newPw + "\n" +
"Logge Dich damit bitte auf der Homepage ein und �ndere unter \"Mein Konto\" das Passwort.\n\n" +
try {
message.setText(new String(messageText.getBytes("ISO-8859-1")));
} catch (UnsupportedEncodingException ex) {
logger.error(ex);
try {
mailSender.send(pwMessagePreparator);
} catch (MailException e) {
logger.warn("Senden der Mail f�r User " + address + " nicht erfolgreich: " + e.getMessage());
}The text is German, never mind its meaning, what counts is that there are umlauts in it. The message is displayed correctly, the header is also correct:
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 8bitI set mail.smtp.allow8bitmime to true.
As soon as I deploy the code on my production machine, the header looks like this:
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 7bitNo matter what I do, it is always set to 7bit. Therefore, the umlauts are not transmitted correctly. I also tried lots of different things, including setting the charset to different values, using MimeUtility and so on. Nothing worked.
Any suggestions are highly appreciated.
Best regards,
Jan-Philipp Stegh�ferI now set the Tomcat Locale to de_CH. This had no effect on the encoding. I also changed the code and removed the MimeMessageHelper. It now looks like this:
MimeMessagePreparator pwMessagePreparator = new MimeMessagePreparator() {
public void prepare(MimeMessage mimeMessage) throws MessagingException {
//mimeMessage.setHeader("Content-Transfer-Encoding", "8bit");
mimeMessage.setSubject("Engineering-Days - Neues Passwort", "ISO-8859-1");
mimeMessage.addRecipient(RecipientType.TO, new InternetAddress(address));
mimeMessage.setFrom(new InternetAddress("[email protected]"));
mimeMessage.setText("Hallo!\n\n" +
"Dein Passwort wurde neu gesetzt. Es lautet jetzt: " + newPw + "\n" +
"Logge Dich damit bitte auf der Homepage ein und �ndere unter \"Mein Konto\" das Passwort.\n\n" , "ISO-8859-1");
try {
mailSender.send(pwMessagePreparator);
} catch (MailException e) {
logger.warn("Senden der Mail f�r User " + address + " nicht erfolgreich: " + e.getMessage());
}The problem remains. Is it possible that the switch from a Windows to a Linux machine causes this effect?
On the other hand, most e-mails are encoded with "quoted-printable". In this encoding, the special signs are encoded as a sequence of characters starting with '='. Can I force JavaMail to use this transfer encoding?
Message was edited by:
Jan-Philipp.Steghoefer
Maybe you are looking for
-
Training and Event Management Business Events
Hi Experts, I would like to know if there is any BAPI/ FM available to create a Business Event Under particular Busness Group and Type. I have Some more things to have a clarification on 1. When we create Business Event in PV10, Where all the data is
-
This is my first post. Hope I am entering it correctly. Open Office requires Java which exposes Macs to Hackers. A recent MacWorld magazine recommends removing Java which is not loaded with Mavericks. Could my Mac Pro been comprised with Java being p
-
Make a hard drive attached to the Airport Extreme work with Time Capsule?
I have an external hard drive attached to my airport extreme that shows up on my desktop as if it was attached locally, but time machine recognizes it as the wrong format. In the Get Info screen, the drive's format appears to be 'Appleshare', when it
-
How can I copy, paste and edit a phone number?
If I copy a phone number then paste it, how can I edit the pasted number? For example, my phone has an Irish SIM. If I am in the UK and copy a UK phone number from an email signature it will typically be in local format i.e. 0208 456 7890. I need to
-
Pause SLA Clock in CRM_DNO_MONITOR
Dear Experts Is there any way to pause the SLA Clock while the Status of Support Message in CRM_DNO_MONITOR will be changed to Customer Action ?? The SLA Clock will be resumed after changing the User Status from Customer Action to other Status. Pleas