Encoded "From" header issue

Hi,
I would like to know if there is any method in the JavaMail API to retrieve the only email address from an encoded "From" header without using, splits, regexs, etc.
Example:
Using aMimeMessage.getFrom()[0].toString() the output is +=?iso-8859-1?Q?Andr=E9_Silva?=<[email protected]>+;
using MimeUtility.decode(aMimeMessage.getFrom()[0].toString()); the output is Andr&eacute; Silva<[email protected]>
Wanted output: [email protected]

Hi!
Create a new instance of object InternetAddress :
System.out.println("\tFrom : " + new InternetAddress(mime_mess.getFrom()[0].toString()).getAddress());
System.out.println("\tPersonnal : " + new InternetAddress(mime_mess.getFrom()[0].toString()).getPersonal());
regards,
this code is patented... :)

Similar Messages

  • Encoding of a From Header

    Original Header:
    From: ���� �������� ������������ <[email protected]>
    I have used MimeUtil class to encode the from value
    String encodedValue = MimeUtility.encodeText(value, ctgContext.getCharSet(), null);
    String foldedValue = MimeUtility.fold(0, encodedValue);
    In the email, the encoded value looks like (there is a white space):
    From: =?ISO-8859-5?Q?=DF=DE_=D4=D5=DB=E3_=BC=D0=D9=DA=DB=D0__<russian?= [email protected]>?=
    When on the client side, I invoke getFrom method on MimeMessage object, I get illegal whitespace exception.
    Address[] add = actualMsg.getFrom();
    Exception:
    javax.mail.internet.AddressException: Illegal whitespace in address in string ``russian?= [email protected]''
    Can anyone help me understand how I can get rid of this exception.

    I assume the original header was created by some
    other program? If so, that program is clearly buggy
    because it's not encoding the header as it should.
    In normal usage, you should never need to encode
    or decode headers or address strings yourself.
    In this case, if you're dealing with a broken mail program,
    you can try to convert the unencoded header to a
    properly encoded header. JavaMail will probably
    be able to parse the original header, but the
    personal name field won't be correct. You'll need
    to extract the bytes from the string and reconvert
    them using your best guess as to the correct
    charset for the string. I think there's examples
    of that in this forum somewhere but let me know
    if you can't figure it out.

  • "From" header in Mail no longer working correctly.

    The "From" header in Mail is working differently, and not of any use, in Yosemite. Prior to the update I could click on a recipient's name, then click the "From" header above, and get a list of all emails from that particular recipient. Now, regardless of which recipient is highlighted, clicking the "From" header sorts all emails from each recipient together, but in alphabetical order. So now to find all the emails from a recipient's name starting with an "M", I have to scroll through all the A's, B's, C's, etc until I get to the M's. Is anybody else having this issue & is there a way to fix it?

    Problem solved. I guess I didn't type the dash correctly. Re-did it and now the hotkeys appear in the accounts list and they work when I apply them.

  • Media Encoder From AP-Pro not working

    Hi,
    I'm trying to export a premiere pro file, I go through the "export settings" like normal and then "ok", it goes to "exporting data" but then doesn't go anywhere.
    Normally it should access the "Adobe Media Encoder" but it does nothing. When I try to access "Adobe media encoder from the programs it comes up with the error message:
    "Adobe Media Encoder.exe - Entry Point Not Found" - "The procedure entry point ??0NewHandlerInitializer@ErrorManager@config@@QAE@XZ could not be located in the dynamic link library dvacore.dll".
    So I'm guessing it needs reinstalling but where do I get it from? It is not in the Premiere setup files and it's not on the adobe website, only the updates are.
    I'm using Windows XP and AP-Pro CS4
    Regards,

    Just had the same problem. I have had cs2 cs3 and cs4 on the same PC Windows XP Pro.
    The exact error message as the o.p. was appearing during export from Premier and when opening Encore.
    I was able to resolve this issue after weeks by simply ...
    Close all Adobe programs and restart computer.
    Go to Windows>Control Panel>Adobe Version Cue CS4
    Adobe Version Cue Server window will appear.
    Make sure your firewall is not blocking Version Cue or Adobe Updater.
    Click Updates tab.
    Click "Check for Updates" button.
    Adobe Updater will connect with the update server. Click Details.
    Checkmark Media Encoder and Photoshop Media Encoder.
    Download the latest Adobe Media Encoder updates.
    Im finally encoding right now so Im not stopping to look at the update version, lol. but my current version of Media Encoder is now 4.2.0.006
    [email protected] wrote:
    Hi,
    I'm trying to export a premiere pro file, I go through the "export settings" like normal and then "ok", it goes to "exporting data" but then doesn't go anywhere.
    Normally it should access the "Adobe Media Encoder" but it does nothing. When I try to access "Adobe media encoder from the programs it comes up with the error message:
    "Adobe Media Encoder.exe - Entry Point Not Found" - "The procedure entry point ??0NewHandlerInitializer@ErrorManager@config@@QAE@XZ could not be located in the dynamic link library dvacore.dll".
    So I'm guessing it needs reinstalling but where do I get it from? It is not in the Premiere setup files and it's not on the adobe website, only the updates are.
    I'm using Windows XP and AP-Pro CS4
    Regards,

  • Modify the from header depending of destination domain in Exchange 2007

    Hello.
    I have an Exchange 2007 organization. One edge and 2 mailbox-cas-hub servers. I want to modify the "From" header depending of destination domain.
    For example, if the destination domain is @example.com and the sender is
    [email protected], the new sender must be changed to
    [email protected] . The user1 has both email address added as smtp address and @newdomain.com was set as primary address to respond and receive emails.
    I have tried with transport rule but I cannot create it, because I received an error when I want to modify the "From" value. The command and error message are:
    Command:
    New-TransportRule -Name 'Test' -Comments
    '' -Priority '0' -Enabled $false -From
    '[email protected]' -SentToScope
    'NotInOrganization' -RecipientAddressContainsWords
    '@example.com'
    -SetHeaderName 'From' -SetHeaderValue
    '[email protected]'
    Error:
    You can't set header 'From' with value
    '[email protected]'
    I have tried without "@" and only with the username, but I got the same error.
    I have been the New-AddressRewriteEntry option, but on this command I cannot set a specific destination domain, only it can set an internaldomain and externaldomain parameters.
    I would like to resolve this issue with Exchange 2007 tools or commands, but I guess this requirement can be done with a third-party tool, anyone knows any?
    Thanks and regards.

    I think what you're trying to do is pretty unusual, at least for Exchange. :-)
    I don't know of anything that would run on Exchange that would be able to do that, but I think you can do it with something like Postfix.
    http://www.108.bz/posts/it/conditional-address-rewriting-with-postfix/
    http://comments.gmane.org/gmane.mail.postfix.user/228099
    --- Rich Matheisen MCSE&I, Exchange MVP

  • Error while creating a PO - Please select Purchasing Organization from Head

    Hi All,
    We have recently upgraded to R12 from 11.5.9 in Test environment. Due to upgrade all the purchasing setup which was there in 11.5.9 is now available in R12.
    We are creating a Standard Purchase Order. I have entered the header level details with default operating unit. Now when i am tryong to update the line level details, system is giving an error message ' Please select Purchasing Organization from Header'.
    Could anyone of you guide us on the change in setup that needs to be done in R12.
    Thanks in advance.
    -Sujay

    Sorry guys.. This is a form personalization.

  • How to view "From" header field in OUTgoing messages in Mail? Frustrating.

    In Mail v.4.3 (in OSX 10.6.4), I need to view the "From" field in my outgoing messages as I am composing them. However, there seems to be no setting in Mail which allow this.
    I find this very frustrating because in Eudora (which I used to use), the "From" field in outgoing messages is visible by default. But in Mail, not only is it not visible by default, there seems to be no way to make it visible.
    In the "Customize..." button to the left of the Subject field in outgoing messages, one has the option to add as default outgoing message fields "cc," "bcc," "Reply-To," and "Subject," but none of those are what I want. It allows one to also view the address of the mail server, but that also is not what I'm looking for. What I want is to see my outgoing +email address+. And nowhere is there an option in the Preferences to turn this on. (At least as far as I could tell.)
    In fact, the only way to see the identity in the outgoing "From" field is to go to Preferences, then click on Accounts, and look there; or send oneself a test email. Both of which are a hassle and should be unnecessary.
    In case you're curious as to why I want to see my outgoing "From" header field:
    I have several different "personas" online, each of which uses a different email address: My work address (with a work-related domain); my family/personal address (with a different email address than my work address); an online avatar I use in various gaming sites (also with its own address, since I don't want to use my personal name/address in the gaming community); and so on. However, I have all incoming emails to all accounts auto-forwarded to the same central email account. Most of the time I'm just replying to business emails, so my outgoing "Full Name" and "Email Address" (in Preferences>Accounts) are generally set to my business name and address; but on occasion when I want to reply to a non-business email and not have the recipient see my business email address, I go in to Preferences>Accounts and change "Full Name" and "Email Address" (i.e. what is displayed to the user) to something different. And when I'm done with that, I change it back to my business address.
    However, sometimes I forget if I've changed it back or not, or forget what I've changed it to. In Eudora, All one needed to one was create a new outgoing email and it would display the "From" field so I could instantly see my outgoing identity. But in Mail, there is no "From" field in outgoing emails, so I'm constantly nervous and wondering which outgoing identity I may have changed to and accidentally forgotten to change back from.
    (Yes, yes, I know that if a recipient wanted to be snoopy, they could look at the "full headers" of any incoming email and see the name of my email server, which may different from my displayed email address; but we're not talking about spy-stuff here, I'm just trying to not confuse people and keep business separate from personal.)
    So: is there any way for me to see the outgoing "From" field in the emails I send? Or am I condemned to constantly (and mostly unnecessarily) checking "Preferences>Accounts" to see what I have enetered there?

    Thanks for replying.
    What is the "compose window" to which you are both referring? I could find no reference to such a thing in the Mail menus or Help.
    Do you mean the "Composing" pane in the Preferences? I don't see what either one of you is referring to there, but I did notice there something that could function as an awkward workaround: If I click on the "Automatically CC myself" box in Preferences>Composing, then when I start a new email, my email address is displayed in the "CC" field -- and luckily, Mail allows me to then delete my email address out of the CC field, so I don't have to spam myself with duplicate copies of all my emails. This way, I can at least briefly see what email address I'm using, before I delete it from the CC field. Pretty awkward and unnecessarily laborious, however -- still not a perfect solution.
    Or, by "composing window," are you referring to an outgoing email? As I said in my original comment, I do see what Ernie called "a small box with lines and an arrow at the bottom left of the header box." This is what I had to say about it:
    +"In the "Customize..." button to the left of the Subject field in outgoing messages, one has the option to add as default outgoing message fields "cc," "bcc," "Reply-To," and "Subject," but none of those are what I want. It allows one to also view the address of the mail server, but that also is not what I'm looking for. What I want is to see my outgoing email address. And nowhere is there an option in the Preferences to turn this on. (At least as far as I could tell.)"+
    In other words, when Ernie says, "click the box beside From," I can't do that -- because there is no such option. That's the whole problem in the first place. If there was a "From" field beside which I could click a box to make it appear, I would have done so! But there is no "From" field in the "Customize" section of the "small box with lines and an arrow at the bottom left of the header box."
    I find it completely mystifying that both of you seem to be able to see a "From" field available to be added to the header of outgoing emails, yet no such option is available to me in Mail. What possibly could be causing this? 10.6.4 is freshly installed on my machine, and Mail seems brand new and uncorrupted. And I'm using Mail 4.3, the latest version.
    Are you saying that everyone else can see an option to have a "From" field in their outgoing messages, but I uniquely don't? Very very very strange.

  • Yoga 2 Pro - Wake From Sleep Issue

    Hey Guys,
    Just recently purchased a Y2P (i7 256gb) less than a week ago. The issue i am currently experiencing is when i wake the laptop from sleep, usually at least 15 mins of sleep, the laptop will come up but then the system is considerably laggy/slow & then becomes completely unresponsive so much to the point that it seems as if it freezes. I am not able to move the mouse (trackpad & usb mouse) & the keyboard buttons do not work/register anymore. Pressing the power button does not put the laptop back to sleep but i can still see everything on the screen from where i left off before closing the lid & the laptop goes into sleep mode. Only way i can recover from this issue is to do a hard reset by holding the power button until the machine powers off & then to boot it back up.
    Also, i have updated the BIOS & did all the windows updates from a clean install of Windows 8.1 (different from a factory reset) in order to avoid the Superfish vulnerability. All the drivers have been installed as well (confirmed by the Device Manager).
    Any other people experiencing the same problem & have any potential fix for this issue? Any help on this matter would be much appreciated.
    Solved!
    Go to Solution.

    You can try this -
    Go to Control Panel >> Power Options >> Change Plan Settings (For active plan)
    Click on Change Advanced Power settings
    Under Sleep option, Change the Hybrid Sleep option (to the opposite of whatever is set right now for both On Battery and Plugged In)
    Also, not sure if fastboot is enabled on your laptop but you can try disabling it. Google "Disable fastboot in win 8.1" and you will get the results.
    Let me know if any of those helped you.
    Current System - Lenovo Y510P, GT755M SLI, 8GB RAM, 1TB HDD + 24GB SSD
    When your plans fail, your Real Story begins!!

  • Waking from sleep issues

    Hi, I have a 17" G-5 i-sight imac, running os 10.4.8, and have been having wake from sleep issues similar to what others have posted. These first showed up in late August. About 25 % of the time, when waking the computer from sleep the screen remains black, and after about 10 seconds the fan starts running at full speed, The only way to stop this is to hold in the power key until the computer shuts down, and then restart. What's interesting is that this only seems to happen using my apple wireless keyboard and mouse; when using a usb keyboard and mouse there is no problem. Could this be a bluetooth-related problem? The bluetooth settings are all correct (allow bluetooth device to wake computer, etc). The apple care guy basically said he didn't know how to help me, and it's driving me crazy! The only wired keyboard/mouse I have is from my 233 bondi blue imac, so just using that to avoid the problem is not a good option. Please help!
    Jerry

    If your Mac happily goes to sleep but won't wake up--Hold down the power switch to force-reboot your machine and get it running again.
    Don't worry-your Mac isn't narcoleptic. Its Open Firmware system or NVRAM (nonvolatile RAM) is likely corrupt, and your Mac can't remember how to wake up.
    Restart your Mac and immediately hold down the Command-Option-O-F key combo until you see a somewhat intimidating command-line display that ends with the Open Fimware prompt. Type the following line:
    reset-nvram
    press the return key on your keyboard
    set-defaults
    press return
    reset-all
    press return
    Your Mac will reboot. Once it's running, put it back to sleep to test. If the problem recurs your Energy Saver preferences may be the culprit. Delete the com.apple.PowerManagement.plist file (go to Finder/Hard drive/Library/Preferences/SystemConfiguration)--don't worry, your Mac will regenerate a new one--and then restart to see if that rights the wrong.
    Still didn't work? Might be time to call AppleCare or see an Apple Genius or a technician.
    Cheers!
    DALE

  • Image size from header

    Hi,
    I'm trying to extract image size from header for PNG, JPG, TIFF, BMP and GIF files. So far I got PNG working. I'm having problems finding size info for JPG files. Anyone knows where I can read about it (i didnt find nothing on google) or have the code that works? also for the other image types?
    P.S. I dont wanna read the entire image using Image class cause its too slow.

    Code Snippet:
    ImageInputStream imageStream =
            ImageIO.createImageInputStream(/*File or InputStream*/);
    java.util.Iterator<ImageReader> readers =
            ImageIO.getImageReaders(imageStream);
    ImageReader reader = null;
    if(readers.hasNext()) {
        reader = readers.next();
    }else {
        imageStream.close();
        //can't read image format... what do you want to do about it,
        //throw an exception, return ?
    reader.setInput(imageStream,true,true);
    int imageWidth = reader.getWidth(0);
    int imageHeight = reader.getHeight(0);
    reader.dispose();
    imageStream.close();

  • Detecting character encoding from BLOB stream... (PLSQL)

    I'am looking for a procedure/function which can return me the character encoding of a "text/xml/csv/slk" file stored in BLOB..
    For example...
    I have 4 files in different encodings (UTF8, Utf8BOM, ISO8859_2, Windows1252)...
    With java I'can simply detect the character encoding with JuniversalCharDet (http://code.google.com/p/juniversalchardet/)...
    thank you

    Solved...
    On my local PC I have installed Java 1.5.0_00 (because on DB is 1.5.0_10)...
    With Jdeveloper I have recompiled source code from:
    http://juniversalchardet.googlecode.com/svn/trunk/src/org/mozilla/universalchardet
    http://code.google.com/p/juniversalchardet/
    After that I have made a JAR file and uploaded it with loadjava to my database...
    C:\>loadjava -grant r_inis_prod -force -schema insurance2 -verbose -thin -user username/password@ip:port:sid chardet.jarAfter that I have done a java procedure and PLSQL wrapper example below:
       public static String verifyEncoding(BLOB p_blob) {
           if (p_blob == null) return "-1";
           try
            InputStream is = new BufferedInputStream(p_blob.getBinaryStream());
            UniversalDetector detector = new UniversalDetector(null);
            byte[] buf = new byte[p_blob.getChunkSize()];
            int nread;
            while ((nread = is.read(buf)) > 0 && !detector.isDone()) {
                detector.handleData(buf, 0, nread);
            detector.dataEnd();
            is.close();
           return detector.getDetectedCharset();
           catch(Exception ex) {
               return "-2";
       }as you can see I used -2 for exception and -1 if input blob is null.
    then i have made a PLSQL procedure:
    function f_preveri_encoding(p_blob in blob) return varchar2 is
    language Java name 'Zip.Zip.verifyEncoding(oracle.sql.BLOB) return java.lang.String';After that I have uploaded 2 different txt files in my blob field.. (first one is encoded with UTF-8, second one with WINDOWS-1252)..
    example how to call:
    declare
       l_blob blob;
       l_encoding varchar2(100);
    begin
    select vsebina into l_blob from dok_vsebina_dokumenta_blob where id = 401587359 ;
    l_encoding := zip_util.f_preveri_encoding(l_blob);
    if l_encoding = 'UTF-8' then
       dbms_output.put_line('file is encoded with UTF-8');
    elsif l_encoding = 'WINDOWS-1252' then
       dbms_output.put_line('file is encoded with WINDOWS-1252');
    else
        dbms_output.put_line('other enc...');
    end if;
    end;Now I can get encoding from blob and convert it to database encoding and store datas in CLOB field..
    Here you have a chardet.jar file if you need this functionality..
    https://docs.google.com/open?id=0B6Z9wNTXyUEeVEk3VGh2cDRYTzg
    Edited by: peterv6i.blogspot.com on Nov 29, 2012 1:34 PM
    Edited by: peterv6i.blogspot.com on Nov 29, 2012 1:34 PM
    Edited by: peterv6i.blogspot.com on Nov 29, 2012 1:38 PM

  • Select row and column from header in jtable

    hello i have a problem to select row and column from header in jtable..
    can somebody give me an idea on how to write the program on it.

    Hi Vicky Liu,
    Thank you for your reply. I'm sorry for not clear question.
    Answer for your question:
    1. First value of Open is item fiels in Dataset2 and this value only for first month (january). But for other month Open value get from Close in previous month.
    * I have 2 Dataset , Dataset1 is all data for show in my report. Dataset2 is only first Open for first month
    2. the picture for detail of my report
    Detail for Red number:
    1. tb_Open -> tb_Close in previous month but first month from item field in Dataset2
    espression =FormatNumber(Code.GetOpening(Fields!month.Value,First(Fields!open.Value, "Dataset2")))
    2. tb_TOTAL1 group on item_part = 1
    expression =FormatNumber(Sum(CDbl(Fields!budget.Value)))
    3. tb_TOTAL2 group on item_part = 3 or item_part = 4
    expression =FormatNumber(Sum(CDbl(Fields!budget.Value)) + ReportItems!tb_TOTAL1.Value )
    4. tb_TOTAL3 group on item_part = 2
    expression =FormatNumber(Sum(CDbl(Fields!budget.Value)) - ReportItems!tb_TOTAL2 .Value)
    5. tb_Close -> calculate from tb_TOTAL3 - tb_Open
    expression =FormatNumber(Code.GetClosing(ReportItems!tb_TOTAL3.Value,ReportItems!tb_Open.Value))
    I want to calculate the value of tb_Open and tb_Close. I try to use custom code for calculate them. tb_close is correct but tb_Open is not correct that show value = 0 .
    My custom code:
    Dim Shared prev_close As Double
    Dim Shared now_close As Double
    Dim Shared now_open As Double
    Public Function GetClosing(TOTAL3 as Double,NowOpening as Double)
        now_close = TOTAL3 + NowOpening
        prev_close = now_close
        Return now_close
    End Function
    Public Function GetOpening(Month as String,NowOpen as Double)
        If Month = "1" Then
            now_open = NowOpen
        Else    
            now_open = prev_close
        End If
        Return now_open
    End Function
    Thanks alot for your help!
    Regards
    Panda A

  • Prelink constants from header

    Greetings.
    I'm trying to move program from aix to linux ( SUSE ES 8 ).
    Aix with oracle 7.3.0
    Linux with oracle 8.1.7.4.0
    Problem is with constant values from header-file.
    In header:
    #define KUKKUU 7
    In code01.pc-file we have:
    #include "HEADERFILE.h"
    and
    EXEC SQL
    DECLARE c_KUKKUU CURSOR FOR
    SELECT to_char(F1), F2, F3 FROM TABLE_01
    WHERE F4 = KUKKUU;
    After "proc iname=code01.pc"
    in code01.c we have:
    static char *sq0004 =
    "select to_char(F1) ,F2 ,F3 from TABLE_01 where F4=KUKKUU";
    it should be:
    static char *sq0004 =
    "select to_char(F1) ,F2 ,F3 from TABLE_01 where F4=7";
    What i'm doing wrong?
    -t

    Problem solved. I couldn't fix the problem directly, but I was able to access my 'other' ISP's outgoing mail server (this wasn't possible a few years ago, which is why I never thought of it) and after restarting Mail and creating/erasing a duplicate account it seems to work fine. For some reason Mail seems a bit slow on the uptake when it comes to changing account information...

  • Partner inheritance stop from header to item only for opportunity

    Hi Team,
    Could anybody help me in the below requirement.
    In standard , in any business transaction, partners of Header inherited to Items.
    Table SMOFPARSFA. The parameter PARTNER_NO_INHERIT is intiial.
    I have a requirement, where we need to stop this partner inheritance from header to item for Opportunity only.
    What would be approach to do this. Is there any BADI available for this?
    Appreciate your quick response.
    Thanks
    Sudhansu

    Hi Marion,
    Thanks for the quick response.
    I tried with this BADI but the BADI didnt trigger.
    1. I clicked on Opportunity creation link..
    2. on the details page, the Employee responsible is assigned as my name both in header and item.
    3. Now i changed the Emp resp to another one.
    4.Now it got changed in Item level as well.
    As per my requirement this should not change in Item.
    Note till now i didnt save the Opp.
    Could you please help me in this case.
    Thanks
    Sudhansu

  • Domain duplicated in From header

    When sending mail using Mail.app, From header shows email address this way: [email protected] When I check Account settings, the email address appears normal: [email protected], and I have nothing for a Reply To address. I have several mail accounts set up in Mail.app, and this happening to all of them.
    Is there an option that automatically appends domain to your own email address? I looked through all Prefs but couldn't find anything. I checked with several different recipients, and they all reported receiving email with From header showing this way.
    Thanks.
    iMac Mac OS X (10.4.7)

    Your Mailsserver still thinks its name is simon.ADomain.co.uk.
    This may be due to the system wide hostname ( see +man hostname+ ) or the myhostname setting in
    postfix's main.cf.
    Check for the first with the hostname command.
    Check for the second using +postconf -n | grep ADomain+

Maybe you are looking for