Script to extract info from Mail subject line?

I'd like to set up a rule that copies all subject lines containing text I specify to a text file. For example... all subject lines containing "has subscribed" would be copied to subscribers.txt. Is this possible?

<pre style="
font-family: Monaco, 'Courier New', Courier, monospace;
font-size: 10px;
font-weight: normal;
margin: 0px;
padding: 5px;
border: 1px solid #000000;
width: 720px;
color: #000000;
background-color: #E6E6EE;
overflow: auto;"
title="this text can be pasted into the AppleScript Editor">
using terms from application "Mail"
on perform mail action with messages theMessages
tell application "Finder" to set ptd to (path to desktop folder) as string
tell application "Mail"
repeat with theMessage in theMessages
if subject of theMessage contains "has subscribed" then
set theText to (subject of theMessage & return)
set theFile to ptd & "subscribers.txt"
set theFileID to open for access file theFile with write permission
write theText to theFileID starting at eof
close access theFileID
end if
end repeat
end tell
end perform mail action with messages
end using terms from
</pre>

Similar Messages

  • Can you create a To Do from the Subject line of an email?

    Does anyone know if it's possible to create a To Do from the subject line of an email in Mail?
    Here's what I'm trying to do. I open a mail message, then I can highlight any text in the body of the message. When I do this, the To Do button becomes enabled. If I highlight the subject of the message, the To Do button remains disabled.
    Is there any way of doing this aside from highlighting text, then changing the text?
    Thanks!

    Open Mail Help from the Help menu. One of the main topics listed is how to create to-dos. Click on it to see what you are able "to do."

  • E-mail subject line truncated to 50 characters

    Hi,
       While sending E-mail from workflow the E-mail subject line truncated to 50 characters. Already we are having Note 958426  with our patch SAP_BASIS - SAPKB70011. How to rectify this?
    Regards
    Sam

    Sam,
    We are on SAPKB70012 and are having this problem too.  Have you been able to resolve this?  If so, how?
    Thanks!
    Paul

  • My e-mail subject line is repeated when I try to open an e-mail

    My e-mail subject line is repeated when I try to open an e-mail, so I have to open this line too, before I can read my e-mail. It takes up alot of space & means I have to do another unnecessary thing for EVERY e -mail ! Then I have to CLOSE it twice to get out! What is happening?

    I am having the exact same problem with my Macbook Pro, all of a sudden the password started rejecting and I cannot use that gmail account.  This appears to be a bug.  The quick fix was to set up another gmail account and forward the mail from the old gmail account to the new gmail account that works with the IMAP service.  This way the mail from the gmail account with the rejected password will still come through and appear in MAIL.

  • Generate Insert Statement Script to Extract Data from Table in Oracle 7i

    Hi all, I have an old Oracle legacy system that is running for over 15 years.Every now and then we need to extract data from this table@ ORacle 7i to be imported back to Oracle 10G.
    My thoughts are to create a script of Insert statements in oracle 7 and that to be deployed back to Oracle 10G.
    I found this scripts in Google and not sure how exactly this works.Any explanation on thsi scripts , would be greatly appreciated.I find this scripst may help to generate a set of insert statements from that table to the latest table at 10G.
    <pre>
    -- Step 1: Create this procedure:
    create or replace Function ExtractData(v_table_name varchar2) return varchar2 As
    b_found boolean:=false;
    v_tempa varchar2(8000);
    v_tempb varchar2(8000);
    v_tempc varchar2(255);
    begin
    for tab_rec in (select table_name from user_tables where table_name=upper(v_table_name))
    loop
    b_found:=true;
    v_tempa:='select ''insert into '||tab_rec.table_name||' (';
    for col_rec in (select * from user_tab_columns
    where
    table_name=tab_rec.table_name
    order by
    column_id)
    loop
    if col_rec.column_id=1 then
    v_tempa:=v_tempa||'''||chr(10)||''';
    else
    v_tempa:=v_tempa||',''||chr(10)||''';
    v_tempb:=v_tempb||',''||chr(10)||''';
    end if;
    v_tempa:=v_tempa||col_rec.column_name;
    if instr(col_rec.data_type,'CHAR') > 0 then
    v_tempc:='''''''''||'||col_rec.column_name||'||''''''''';
    elsif instr(col_rec.data_type,'DATE') > 0 then
    v_tempc:='''to_date(''''''||to_char('||col_rec.column_name||',''mm/dd/yyyy hh24:mi'')||'''''',''''mm/dd/yyyy hh24:mi'''')''';
    else
    v_tempc:=col_rec.column_name;
    end if;
    v_tempb:=v_tempb||'''||decode('||col_rec.column_name||',Null,''Null'','||v_tempc||')||''';
    end loop;
    v_tempa:=v_tempa||') values ('||v_tempb||');'' from '||tab_rec.table_name||';';
    end loop;
    if Not b_found then
    v_tempa:='-- Table '||v_table_name||' not found';
    else
    v_tempa:=v_tempa||chr(10)||'select ''-- commit;'' from dual;';
    end if;
    return v_tempa;
    end;
    show errors
    -- STEP 2: Run the following code to extract the data.
    set head off
    set pages 0
    set trims on
    set lines 2000
    set feed off
    set echo off
    var retline varchar2(4000)
    spool c:\t1.sql
    select 'set echo off' from dual;
    select 'spool c:\recreatedata.sql' from dual;
    select 'select ''-- This data was extracted on ''||to_char(sysdate,''mm/dd/yyyy hh24:mi'') from dual;' from dual;
    -- Repeat the following two lines as many times as tables you want to extract
    exec :retline:=ExtractData('dept');
    print :retline;
    exec :retline:=ExtractData('emp');
    print :retline;
    select 'spool off' from dual;
    spool off
    @c:\t1
    -- STEP3: Run the spooled output c:\recreatedata.sql to recreate data.
    Source:http://www.idevelopment.info/data/Oracle/DBA_tips/PL_SQL/PLSQL_5.shtml
    </pre>

    Thanks Justin.
    I get what you are saying,i really wanted to see the output of the codes, because the furtherst i could get from that code is
    SELECT EXTRACTDATA('MYTABLE') FROM MYTABLE;
    and it generated this:
    "select 'insert into MYTABLE ('||chr(10)||'DATE1,'||chr(10)||'TIME1,'||chr(10)||'COUNTS) values ('||decode(DATE1,Null,'Null','to_date('''||to_char(DATE1,'mm/dd/yyyy hh24:mi')||''',''mm/dd/yyyy hh24:mi'')')||','||chr(10)||''||decode(TIME1,Null,'Null',TIME1)||','||chr(10)||''||decode(COUNTS,Null,'Null',COUNTS)||');' from MYTABLE;
    select '-- commit;' from dual;"
    "select 'insert into MYTABLE ('||chr(10)||'DATE1,'||chr(10)||'TIME1,'||chr(10)||'COUNTS) values ('||decode(DATE1,Null,'Null','to_date('''||to_char(DATE1,'mm/dd/yyyy hh24:mi')||''',''mm/dd/yyyy hh24:mi'')')||','||chr(10)||''||decode(TIME1,Null,'Null',TIME1)||','||chr(10)||''||decode(COUNTS,Null,'Null',COUNTS)||');' from MYTABLE;
    select '-- commit;' from dual;"
    "select 'insert into MYTABLE ('||chr(10)||'DATE1,'||chr(10)||'TIME1,'||chr(10)||'COUNTS) values ('||decode(DATE1,Null,'Null','to_date('''||to_char(DATE1,'mm/dd/yyyy hh24:mi')||''',''mm/dd/yyyy hh24:mi'')')||','||chr(10)||''||decode(TIME1,Null,'Null',TIME1)||','||chr(10)||''||decode(COUNTS,Null,'Null',COUNTS)||');' from MYTABLE;
    select '-- commit;' from dual;"
    "select 'insert into MYTABLE ('||chr(10)||'DATE1,'||chr(10)||'TIME1,'||chr(10)||'COUNTS) values ('||decode(DATE1,Null,'Null','to_date('''||to_char(DATE1,'mm/dd/yyyy hh24:mi')||''',''mm/dd/yyyy hh24:mi'')')||','||chr(10)||''||decode(TIME1,Null,'Null',TIME1)||','||chr(10)||''||decode(COUNTS,Null,'Null',COUNTS)||');' from MYTABLE;
    select '-- commit;' from dual;"
    "select 'insert into MYTABLE ('||chr(10)||'DATE1,'||chr(10)||'TIME1,'||chr(10)||'COUNTS) values ('||decode(DATE1,Null,'Null','to_date('''||to_char(DATE1,'mm/dd/yyyy hh24:mi')||''',''mm/dd/yyyy hh24:mi'')')||','||chr(10)||''||decode(TIME1,Null,'Null',TIME1)||','||chr(10)||''||decode(COUNTS,Null,'Null',COUNTS)||');' from MYTABLE;
    select '-- commit;' from dual;"
    "select 'insert into MYTABLE ('||chr(10)||'DATE1,'||chr(10)||'TIME1,'||chr(10)||'COUNTS) values ('||decode(DATE1,Null,'Null','to_date('''||to_char(DATE1,'mm/dd/yyyy hh24:mi')||''',''mm/dd/yyyy hh24:mi'')')||','||chr(10)||''||decode(TIME1,Null,'Null',TIME1)||','||chr(10)||''||decode(COUNTS,Null,'Null',COUNTS)||');' from MYTABLE;
    select '-- commit;' from dual;"
    I was expecting a string of
    insert into mytable values (19/1/2009,1,1);
    insert into mytable values (19/10/2008,5,10);
    Thanks for the explanation .

  • Mail Subject Line Automatically Selects All Text When Typing

    In Mail I'm typing along in a subject line and randomly the all of text I've entered becomes selected. Then my next keystroke deletes the first entered text. Very frustrating, and I can't figure out why this happens. Maybe OSX's spell checker? How do I turn that off to test?

    Please read this whole message before doing anything.
    This procedure is a diagnostic test. It won’t solve your problem. Don’t be disappointed when you find that nothing has changed after you complete it.
    Third-party system modifications are a common cause of usability problems. By a “system modification,” I mean software that affects the operation of other software — potentially for the worse. The following procedure will help identify which such modifications you've installed. Don’t be alarmed by the complexity of these instructions — they’re easy to carry out and won’t change anything on your Mac. 
    These steps are to be taken while booted in “normal” mode, not in safe mode. If you’re now running in safe mode, reboot as usual before continuing. 
    Below are instructions to enter some UNIX shell commands. The commands are harmless, but they must be entered exactly as given in order to work. If you have doubts about the safety of the procedure suggested here, search this site for other discussions in which it’s been followed without any report of ill effects. 
    Some of the commands will line-wrap or scroll in your browser, but each one is really just a single line, all of which must be selected. You can accomplish this easily by triple-clicking anywhere in the line. The whole line will highlight, and you can then copy it. The headings “Step 1” and so on are not part of the commands. 
    Note: If you have more than one user account, Step 2 must be taken as an administrator. Ordinarily that would be the user created automatically when you booted the system for the first time. The other steps should be taken as the user who has the problem, if different. Most personal Macs have only one user, and in that case this paragraph doesn’t apply. 
    Launch the Terminal application in any of the following ways: 
    ☞ Enter the first few letters of its name into a Spotlight search. Select it in the results (it should be at the top.) 
    ☞ In the Finder, select Go ▹ Utilities from the menu bar, or press the key combination shift-command-U. The application is in the folder that opens. 
    ☞ Open LaunchPad. Click Utilities, then Terminal in the icon grid. 
    When you launch Terminal, a text window will open with a line already in it, ending either in a dollar sign (“$”) or a percent sign (“%”). If you get the percent sign, enter “sh” and press return. You should then get a new line ending in a dollar sign. 
    Step 1 
    Triple-click the line of text below on this page to select it:
    kextstat -kl | awk '!/com\.apple/{printf "%s %s\n", $6, $7}' | open -f -a TextEdit 
    Copy the selected text to the Clipboard by pressing the key combination command-C. Then click anywhere in the Terminal window and paste (command-V). A TextEdit window will open with the output of the command. If the command produced no output, the window will be empty. Post the contents of the TextEdit window (not the Terminal window), if any — the text, please, not a screenshot. You can then close the TextEdit window. The title of the window doesn't matter, and you don't need to post that. No typing is involved in this step.
    Step 2 
    Repeat with this line:
    { sudo launchctl list | sed 1d | awk '!/0x|com\.(apple|openssh|vix)|org\.(amav|apac|cups|isc|ntp|postf|x)/{print $3}'; sudo defaults read com.apple.loginwindow LoginHook; sudo crontab -l; } 2> /dev/null | open -f -a TextEdit 
    This time you'll be prompted for your login password, which you do have to type. Nothing will be displayed when you type it. Type it carefully and then press return. You may get a one-time warning to be careful. Heed that warning, but don't post it. If you see a message that your username "is not in the sudoers file," then you're not logged in as an administrator. 
    Note: If you don’t have a login password, you’ll need to set one before taking this step. If that’s not possible, skip to the next step. 
    Step 3
    { launchctl list | sed 1d | awk '!/0x|com\.apple|org\.(x|openbsd)/{print $3}'; crontab -l 2> /dev/null; } | open -f -a TextEdit 
    Step 4
    ls -A /e*/{la,mach}* {,/}L*/{Ad,Compon,Ex,Fram,In,Keyb,La,Mail/Bu,P*P,Priv,Qu,Scripti,Servi,Spo,Sta}* L*/Fonts .la* 2> /dev/null | open -f -a TextEdit  
    Important: If you formerly synchronized with a MobileMe account, your me.com email address may appear in the output of the above command. If so, anonymize it before posting. 
    Step 5
    osascript -e 'tell application "System Events" to get name of every login item' | open -f -a TextEdit 
    Remember, steps 1-5 are all copy-and-paste — no typing, except your password. Also remember to post the output. 
    You can then quit Terminal.

  • E-mail Subject Line

    I am using LC8 and I have created a form with a submit button for e-mail. I used the regular button instead of the e-mail from the previous posts that I have read. I have it set to "mailto:" so the user filling out the form will need to enter the e-mail address. How do I prepopulate the subject line with some standard text instead of the name of the pdf? Also, is there anyway to have the pdf document renamed by pulling the data from one of the text fields?
    TIA

    I am using LC8 and I have created a form with a submit button for e-mail. I used the regular button instead of the e-mail from the previous posts that I have read. I have it set to "mailto:" so the user filling out the form will need to enter the e-mail address. How do I prepopulate the subject line with some standard text instead of the name of the pdf? Also, is there anyway to have the pdf document renamed by pulling the data from one of the text fields?
    TIA

  • Me32K - Need to change the mail subject line, attachment name

    Hi,
    can u please throw light on the below three points which needs to be achieved.
    1. Subject line of the mail needs to be modified from standard to "PO# XXXXXXXXXX".
    2.  Attachment name should be updated from stanadrd to "PO_XXXXXXXXXX".
    3. Also by default mail will be delivered to the default id, but it should be delivered to multiple mail ids maintained in the vendor master.
    I should achieve the above by user exits or by Zprogram copying from th standard.
    Please advise me.
    Thanks a lot.
    Regards,
    Kiran

    check in Tcode: NACE, what is the current driver program and form against your document type.
    and then change accordingly

  • Mail Subject Line BOLD

    I don't remember the defaults for mail to have every subject line bold in my inboxes. I have checked "Rules" and I don't have anything to due with bold. Is this standard to have every subject line bold or can I somehow turn this off? It's pretty annoying. Thanks

    It is only bold if the message hasn't been opened from within Mail. You can select as many bold messages at once and mark them as unread to make them no longer bold.

  • Mail subject line and safari Goggle Search window removing spaces between words

    After upgrading to Lion I can no longer type out a subject line in Mac Mail witout the spaces automaicaly being removed. All words run together. Same situation in Safari's Google Search window. No issues in FireFox. Driving me nuts. Any others with this issue?

    Found the answer to this issue. I'm amazed this received no responce from the community. Must mean I was the only one with such issue. Amazinly, the exact same thing was happening on three differnt Macs that I loaded Lion to. The answer was given to me by a very helpful and SMART tech person at Apple Care. Two other Apple Care techs were going to have me reinstall the entire OS after wiping my computers clean. I finally found someone that knew what they were doing. He simply took me to Apple>Preferences>Language & Text. Then I selected the Text Tab and then went to the bottom of the window and Reset Default Settings. Bingo, all was fixed. Each machine I did the same thing on and all are working fine now. Hope by me typing this up will help others if needed since not one person responded to this inquirey.

  • Mail subject lines blue or disappearing!

    My Mail is acting weird for about a week now. Two things.
    1. Large numbers of the subject lines in the top panel where my mail is listed will turn blue. They'll turn back to the normal black text sometimes either when I scroll or restart Mail.
    2. The subject lines started completely disappearing today!  They're still there, as if in white font on white background and I can still click on them and read the email, but they're invisible.
    Is Mail malfunctioning because it can't handle thousands of saved emails?  That's a bummer if true.  I thought I could use it like an archive.
    I searched the communities for answers first and read something about "rebuilding" mailboxes which I'd never heard of before. If that's what I need to do can you direct me to complete instructions. I don't want to lose my emails.
    Thank you for helping!

    Hi Michele,
    Not likely too many eMails doing it.
    Open Activity Monitor in Applications>Utilities, select All Processes & sort on CPU%, any indications there?
    How much RAM & free space do you have also, click on the Memory & Disk Usage Tabs.
    Open Console in Utilities & see if there are any clues or repeating messages when this happens.
    In the Memory tab of Activity Monitor, are there a lot of Pageouts?
    If you want to Rebuild a Mailbox...
    Safe Boot from the HD, (holding Shift key down at bootup),  it will try to repair your Disk Directory while the spinning radian is happening, so let it go, run Disk Utility in Applications>Utilities, then highlight your drive, click on Repair Permissions.
    In Mail, highlight that Mailbox, under Mail's Mailbox menu item, choose rebuild.
    Reboot.

  • Problem reading japanese mail subject line

    I am using
    javax.mail.Message.getSubject() method to read the Japanese subject line of the mail, but when i see the string returned by this method, it has some junk characters.
    Can anyone please tell me how to read japanese subject line?

    Hi Pothana,
    I did try to change the encoding of the Exchange server to UTF-8, but there was no difference in the result.
    Note that this problem is only in the subject line.  If I send the same text in the content it is received correctly.
    (Changing the encoding of PI is not an option... I do not have access to the Visual Administrator).
    @Ninad since I am taking the Subject from the ASMA (as suggested by SAP) I don't think that changing the content encoding of the message would make a difference.
    @Ashutosh I do have that document but I can't find anything that can help me in there.  Do you see anything that could help resolve this specific issu?
    In the mean time the problem is still there...
    Thanks for any additional help you can give me,
    Aldo

  • OdiReadMail  - extract field from and subject in file

    Tool odiReadMail extract the body of the message in to file.
    I wont extract in this file fields form e-mal "from" and "subject". How i can do it?

    Yes. I want to extract fields "subject", "sender" and body mail message and place them in a file.
    I think, that it is necessary to change odiReadMail. But I do not know where to find source codes of this ODI tools.
    Message was edited by:
    RAD

  • Removing Text From Incoming Subject Line

    My ISP automatically adds "*SPAM*" to the subject line of e-mails it suspects of being spam. It's a great feature, but as can be expected, sometimes it marks a message that isn't spam. Is there a way to automatically remove the tag from e-mails that meet certain criteria, i.e.: the sender is a previous recipient?

    Mail doesn't allow any editing of received messages. Mail Tags may be able to help, but I don't think so.
    AK

  • Mail Subject Line

    I would like to have a constant font throughout my e-mail. I have played around in the preferences and set the default message font to times new roman which works, however the font type in the subject line does not seem to change. Even if I bring up the font panel and change it there, nothing changes. So is there anyway that I can change the font in the subject line to times new roman?
    Thanks
    Bruce

    The Subject line is part of the email headers. It is plain text. It does not have styles (fonts, etc.) associated with it. You cannot control how headers will be displayed to the recipients.

Maybe you are looking for

  • How to manually delete Po at header level ?

    Hi, I can delete PO line items in my ECC60 system However, i would like to delete PO at header level. In EKKO , i can see the deletion flag in LOEKZ field. BUT in ME22N, i cannot find any button to delete PO at header level... Could somebody clarify

  • Post a parked invoice in the background (MIR4)

    Hi, I need to post a parked invoice that was parked with function BAPI_INCOMINGINVOICE_PARK. I wrote a program which uses BDC to post this invoice with ( transaction MIR4  post button ). It runs fine in the foreground but cannot run in the background

  • My eprint app is not signing in to my verizon email account, anyone else having this problem?

    my eprint app is not signing in to my verizon email account, anyone else having this problem?

  • Database buffer Cache

    Hi Guru, Can anyone tell me what is the actual definition of Data buffer Cache & Log buffer Cache and how it works in Oracle 10g?? Please Regards, Rajeev,India Edited by: 970371 on Nov 8, 2012 7:06 PM

  • Transaction in bdc

    hi, plz provide me example for a bdc program that i call two transaction code in one bdc programm the two *T-CODE are FBS1 & F.81 * FROM ANY ONE BY CALL TRANSACTION OR BY SESSION METHOD. JUST GIVE ME EXAMPLE THANKS jayant