[Solved] Script to count new mail

This is a very simple problem that's confusing the hell out of me.
I want to show how many new (unread) emails I have, in my Awesome taskbar, and have it run every 10 minutes.
So I wrote a small perl script and it worked, showing 1 new mail.
The problem is that running the script again says there's no new mail. I figured the library calls were setting the new mail as read. So I tried again in python using imaplib, which lets you open the imap folder as readonly. But the same problem happens again, subsequent calls say there's no new mail.
I tried someone else's script found here but got the same result.
Can someone tell me what I'm missing here?
Last edited by r6 (2009-03-24 03:12:40)

I'm using a script I found in conky that pulls similar information out of the RSS/atom feed from gmail.
Here's the code:
## check-gmail.py -- A command line util to check GMail -*- Python -*-
## modified to display mailbox summary for conky
# ======================================================================
# Copyright (C) 2006 Baishampayan Ghose <[email protected]>
# Modified 2008 Hunter Loftis <[email protected]>
# Time-stamp: Mon Jul 31, 2006 20:45+0530
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License version 2 as
# published by the Free Software Foundation.
# ======================================================================
import sys
import urllib # For BasicHTTPAuthentication
import feedparser # For parsing the feed
from textwrap import wrap
_URL = "https://mail.google.com/gmail/feed/atom"
uname = sys.argv[1]
password = sys.argv[2]
maxlen = sys.argv[3]
urllib.FancyURLopener.prompt_user_passwd = lambda self, host, realm: (uname, password)
def auth():
'''The method to do HTTPBasicAuthentication'''
opener = urllib.FancyURLopener()
f = opener.open(_URL)
feed = f.read()
return feed
def readmail(feed, maxlen):
'''Parse the Atom feed and print a summary'''
atom = feedparser.parse(feed)
print '%[email protected] (%s new)\n' % (uname, len(atom.entries))
# for i in range(min(len(atom.entries), maxlen)):
# print ' "%s"' % atom.entries[i].title
# print ' %s' % atom.entries[i].author
# if len(atom.entries) > maxlen:
# print ' more...'
if __name__ == "__main__":
f = auth() # Do auth and then get the feed
readmail(f, int(maxlen)) # Let the feed be chewed by feedparser
then you just call the script with python /path/to/script/ username password #ofEmailTitlesToDisplay.
Hope that helps?
Lswest
it requires the package python-feedparser from extra.
Last edited by lswest (2009-03-19 19:14:34)

Similar Messages

  • Script that shows new mails from Google Apps account in conky

    Hello guys,
    I'm looking for a script that outputs the number of new mails I received from my Mail Account with Google Apps.
    I've already found a script that works pretty well with the normal Gmail but not obviously not with Google Apps.
    import os
    import string
    #Enter your username and password below within double quotes
    # eg. username="username" and password="password"
    username="username"
    password="********"
    com="wget -O - https://"+username+":"+password+"@mail.google.com/mail/feed/atom --no-check-certificate"
    temp=os.popen(com)
    msg=temp.read()
    index=string.find(msg,"<fullcount>")
    index2=string.find(msg,"</fullcount>")
    fc=int(msg[index+11:index2])
    if fc==0:
    print "0 new"
    else:
    print str(fc)+" new"
    My idea was to replace mail.google.com/mail/feed/atom with mail.google.com/a/domain.tld/feed/atom but I always get connection errors like this.
    Connection to mail.google.com|209.85.135.16|:443... connected.
    HTTP request sent, wait for answer... 401 Unauthorized
    Connection to mail.google.com|209.85.135.16|:443... connected.
    HTTP request sent, wait for answer... 401 Unauthorized
    Authorisation failed.
    Traceback (most recent call last):
    File "/home/orschiro/.scripts/mail.py", line 15, in <module>
    fc=int(msg[index+11:index2])
    ValueError: invalid literal for int() with base 10: ''
    Any suggestion what I could try?
    Thank you in advance.
    Last edited by orschiro (2009-06-19 17:55:07)

    Here is part of a script that I am using with my Google Apps domain. Should be easy to follow. Just edit the three variables at the top of the script. I prompt for the password at boot so it is not hard coded in the script. I use x11-ssh-askpass for this.
    MAIL_URL = ['https://', 'mail.google.com', '/a/domain.com/feed/atom']
    USERNAME = "[email protected]"
    PASSWD = "password"
    def initMail():
    passman = urllib2.HTTPPasswordMgrWithDefaultRealm()
    passman.add_password(None, MAIL_URL[1], USERNAME, PASSWD)
    authhandler = urllib2.HTTPBasicAuthHandler(passman)
    opener = urllib2.build_opener(authhandler)
    urllib2.install_opener(opener)
    def checkMail():
    logging.debug("checkMail()")
    try:
    f = urllib2.urlopen("".join(MAIL_URL))
    doc = xml.dom.minidom.parseString(f.read())
    c = doc.getElementsByTagName("fullcount")[0].firstChild.data
    return dzenH1("Mail: ") + c
    except urllib2.URLError as e:
    return dzenH1("Mail: ") + "URLError"

  • Mail hang with multiple pop accounts and invalid new mail counter

    All
    More than a year ago, I migrated all email accounts from Outlook to Apple Mail using O2M application. I have 2 pop accounts and gmail account. Everything worked fine for a few month but then Mail started to hang during message receiving. It did so very often (4/5 times). When it does, nothing will revive it except a "force quit".
    I tried to fetch email from each account individually, that worked well every time. After I was sure that it has to do with getting new mail simultaneously, I tried everything to fix it. I tried to reconstruct all the mail boxes, I tried using only 2 boxes with all combinations (1 pop 1 gmail, 2 pop, etc) but nothing worked.
    I even tried to export all my mail boxes, then delete everything from Mail then reimport them with no luck.
    In addition, a couple of months later, my "Inbox" new mail counter started to sometimes displaying the wrong new mail count. It displays 2-4 new messages while there is none. In order to be sure, I created a smart mail box to have only new mail and it had none. By simply switching to any other folder then returning back to Inbox solves the problem.
    Can any one help?

    Make absolutely sure that your email addresses and configuration are correct. In nearly every case I've encountered, this is the problem.
    If you've confirmed this, make sure you're configured properly on your webmail account, if you have one. Webmail is something like ATT, the source of your internet.
    If you're still flummoxed, play hardball. Make sure you have all your current account info and passwords, and delete them in Mail/Preferences/Accounts. Then, reenter them one by one until they're perfect. This makes sure your settings are consistent and correct.

  • New mail notification counter not appearing in dock

    I've noticed recently that my new mail notification counter doesn't appear in the dock if I have Mail sitting in the background. I can be working in, say, Word, and not know I have new mail. Yet, when I go to Mail there are emails sitting there (and the dock counter appears as soon as I go to Mail.
    Not a major problem, I agree, but it would be nice to fix it, if anyone has any suggestions.
    Cheers
    Phil

    Thanks for the replies. I do have preferences set as you suggest but am not getting the notifications when Mail is in the background. I'll just live with it...
    Cheers
    Phil

  • Mail not showing new mail count

    Very recently, Mail has stopped showing the new mail count next to the corresponding inbox on the bar on the left side of Mail. There are new emails sitting in the indox but it doesn't show a count. I upgraded to Mavericks and it there were no issues but now this is happening. Any ideas why?

    Incoming_Mail
    IncomingTable_ofContents
    Yes, these can also be removed. Tiger Mail no longer uses them. You can confirm this by looking at their modification date. It should be no later than the date you imported your Panther mail into Tiger mail.
    iMac G5 17" (iSight)   Mac OS X (10.4.4)  

  • Mail Dock icon "new mail" count wrong

    The Mail icon in my dock shows 11 new mails. I open Mail and there is no new mail. The icon then shows none, then a bit later it shows 11 again. If I get a real new mail it will show 12 new mails. The actual number of new mail adds to the phantom 11.
    What is going on here?

    I'd get EasyFind...
    http://www.macupdate.com/info.php/id/11076
    Here's a direct download link to EasyFind 4.0 which runs in 10.3.9 & up...
    http://www.devon-technologies.com/files/legacy/macosx1039/EasyFind.dmg.zip
    From this page,
    http://www.devon-technologies.com/support/faqs.php?p=default&cat=19
    Freeware applications:
    * EasyFind 4.0
    * PhotoStickies 5.6
    * ThumbsUp 4.3
    * XMenu 1.8
    http://www.versiontracker.com/dyn/moreinfo/macosx/8707
    Use it to search your whole drive for case insensitive & show invisibles...
    .emlx
    (dot ee em el ex)
    Sort by Date & see if we can find these emails next time the count goes up.

  • [SOLVED] Adapting conky "# of new emails" script to a message preview

    The Conky wiki has a section to display the number of new emails (Gmail) with a python script. It appears that script uses urllib for credentials and then xml.etree to navigate the xml.
    I'm trying to adapt the script to display the sender and title, since they exist in the xml.
    I've been reading the documentation and after looking at the xml I'm pretty sure I need to use indexing, can't get it to work though.
    Here's the script from the wiki with my comments on what I'm trying to add in.
    #! /usr/bin/env python
    import urllib.request
    from xml.etree import ElementTree as etree
    # Enter your username and password below within quotes below, in place of ****.
    # Set up authentication for gmail
    auth_handler = urllib.request.HTTPBasicAuthHandler()
    auth_handler.add_password(realm='New mail feed',
    uri='https://mail.google.com/',
    user= '****',
    passwd= '****')
    opener = urllib.request.build_opener(auth_handler)
    # ...and install it globally so it can be used with urlopen.
    urllib.request.install_opener(opener)
    gmail = 'https://mail.google.com/gmail/feed/atom'
    NS = '{http://purl.org/atom/ns#}'
    with urllib.request.urlopen(gmail) as source:
    tree = etree.parse(source)
    fullcount = tree.find(NS + 'fullcount').text
    # attempt to navigate to sender of email (feed/entry/author/name)
    firstemailsender = tree[0][5][5][0].text
    secondemailsender = tree[0][6][5][0].text
    # attempt to navigate to title of email (feed/entry/title)
    firstemailtitle = tree[0][5][0].text
    firstemailtitle = tree[0][5][0].text
    print(fullcount + ' new')
    # added print that doesn't work because of other things not working
    print (firstemailsender + ' - ' + firstemailtitle)
    print (secondemailsender + ' - ' + secondemailtitle)
    Last edited by heyitstallchris (2015-02-06 14:55:07)

    Hey,
    I've re-written the code to use XPath instead of indexing, IMO it's more robust and compact. findall() returns a list of all Elements that match the given XPath. Make sure to include the namespace before each element name in the path (you can see that below when I use findall() to get all "author/name" elements.
    The code saves all new mails in an array (mails) full of dicts, each with a 'sender' and 'title' keys. The script will blow up if you have zero or one new emails, but you can trivially check the length of the mails array before printing at the end.
    If you have any questions about the code just ask.
    #! /usr/bin/env python
    import urllib.request
    from xml.etree import ElementTree as etree
    # Enter your username and password below within quotes below, in place of ****.
    # Set up authentication for gmail
    auth_handler = urllib.request.HTTPBasicAuthHandler()
    auth_handler.add_password(realm='New mail feed',
    uri='https://mail.google.com/',
    user= '*****',
    passwd= '*****')
    opener = urllib.request.build_opener(auth_handler)
    # ...and install it globally so it can be used with urlopen.
    urllib.request.install_opener(opener)
    gmail = 'https://mail.google.com/gmail/feed/atom'
    NS = '{http://purl.org/atom/ns#}'
    with urllib.request.urlopen(gmail) as source:
    tree = etree.parse(source)
    root = tree.getroot()
    mails = []
    # only iterate over new mails, which have a tag "entry"
    for entry in root.findall(NS+'entry'):
    message = {}
    # locate sender and title info using XPath (?) again
    message['sender'] = entry.findall(NS+'author/'+NS+'name')[0].text
    message['title'] = entry.findall(NS+'title')[0].text
    mails.append(message)
    print(str(len(mails)) + ' new')
    print (mails[0]['sender'] + ' - ' + mails[0]['title'])
    print (mails[1]['sender'] + ' - ' + mails[1]['title'])
    Last edited by spupy (2015-01-28 14:00:56)

  • Disabling badge count of new mail?

    Sorry if this is a dumb question, but is there a way to disable the new mail badge count for a particular account? I have two set up, and only one I want to see the number of new mail.
    Thanks.

    since updating to 2.0.2 on my 3g iphone i've noticed my new mail count is off also...it seems that for every new email i receive with Gmail using IMAP on the iphone, it shows a count of 3...2 new emails shows a number of 6, 3 emails shows 9 etc etc.
    anyone else have this prob and maybe have an idea as to how to fix it??

  • No 'new mail' counter in dock and sender address overwriting

    All of the sudden, new mail doesn't cause the icon in the dock to show the indicator/counter. I have tried resetting mail by throwing out previous settings, plists, etc. but it still isn't there. I also tried reinstalling the latest Tiger combined update. Still didn't work.
    In addition, when I look at mail, the sender's name/address is displayed almost on top of the subject heading.
    Any thoughts on how to fix this? I have also done the usual permissions repair, Disk Utility Repair and even TechTool Pro Repair
    20" intel iMac 2GHz, 2 GB memory   Mac OS X (10.4.8)  

    Everything is back to normal, although just performing the Font Book reset didn't work.
    I looked at all the fonts on my MacBook (in Font Book) and compared it with all the fonts that were on my iMac. Times and Helvetica were not there ( but there were Times CY, and Helvetica CY whatever they are!) There were some others as well. So I added them in using Font Book (rather than just dragging them to the respective Font folders) and now all is right with the world.
    Thanks!

  • ICloud new mail count badge not working in Mail v 5.2 Lion but is working in Mountain Lion on other machines

    I've upgreded 2 of my 3 computers to Mountain Lion, and all seems fine on those 2 machines, but on my older Mac Pro which is not compatible with Mountain, I'm having a problem where the new mail count badge is not showing up either on the iCloud mail box or as part of my total in the dock count badge.  New mail badges is showing up for my other mail boxes, just not iCloud.  I've removed my iCloud inbox, and have re-enabled it and it's still not working.  If I had the problem right at the time I installed Mountain Lion on my other 2 computers, I didn't notice it, so I don't think this problem is related to Mountain Lion on my other machines.

    Glenn,
    Regarding adding and deleting the System Drive from the Spotlight Privacy Tab...... I'm following your sequence, but when I come back to Spotlight Search in the menu bar it just works the same.... no mention of indexing. What's interesting is that "Mail" dosn't appear anywhere in search results when a keyword search is performed via spotlight.
    Regarding the "enevelope Index Files" ..... I followed the instructions and quit and re-opened mail as instructed.  When I re-opened Mail I selected "continue" and the program began to index the contents of mail for about 30 minutes.  I thought that would would fix the issue, but it's still not working. 
    I've tried to compare the account setup from my IMAC which works fine to see if I have something setup wrong in the account, but everything looks the same. 
    I guess I can try to re-index again?  Don't know what else to do? 
    Thanks,
    Bill

  • Hi, my friend. Has a problem psychologically Atabtna It is  Lost e-savior to change the security question has been the savior of new mail in order to put that I could answer the question of safety  But I did not activate the new Alamil hope to solve

    Hi, my friend.
    Has a problem psychologically Atabtna
    It is
    Lost e-savior to change the security question has been the savior of new mail in order to put that I could answer the question of safety
    But I did not activate the new Alamil hope to solve these are the problem

    Resolving this issue requires asking Apple to reset the security questions. To do so, click here and pick a method; if that page doesn't list one for the country or the person is unable to call, fill out and submit this form.
    (124711)

  • Mail refuses to get new mail.

       Mail refuses to get new mail. (Imac 10.9.5, Mail 7.3. ) Connection doc shows wheels to all my accounts spinning (IMap and POP).  Activity  cited Mail was trying to connect to Icloud.  Evidently stuck there.  This is just one problem in a succession of many with the Mail program ever since I upgraded to 10.9.5, but it is the worst so far.  Restarting doesn't seem to fix it.  Any suggestions?

    1. This procedure is a diagnostic test. It changes nothing, for better or worse, and therefore will not, in itself, solve the problem. But with the aid of the test results, the solution may take a few minutes, instead of hours or days.
    Don't be put off by the complexity of these instructions. The process is much less complicated than the description. You do harder tasks with the computer all the time.
    2. If you don't already have a current backup, back up all data before doing anything else. The backup is necessary on general principle, not because of anything in the test procedure. Backup is always a must, and when you're having any kind of trouble with the computer, you may be at higher than usual risk of losing data, whether you follow these instructions or not.
    There are ways to back up a computer that isn't fully functional. Ask if you need guidance.
    3. Below are instructions to run a UNIX shell script, a type of program. As I wrote above, it changes nothing. It doesn't send or receive any data on the network. All it does is to generate a human-readable report on the state of the computer. That report goes nowhere unless you choose to share it. If you prefer, you can act on it yourself without disclosing the contents to me or anyone else.
    You should be wondering whether you can believe me, and whether it's safe to run a program at the behest of a stranger. In general, no, it's not safe and I don't encourage it.
    In this case, however, there are a couple of ways for you to decide whether the program is safe without having to trust me. First, you can read it. Unlike an application that you download and click to run, it's transparent, so anyone with the necessary skill can verify what it does.
    You may not be able to understand the script yourself. But variations of the script have been posted on this website thousands of times over a period of years. The site is hosted by Apple, which does not allow it to be used to distribute harmful software. Any one of the millions of registered users could have read the script and raised the alarm if it was harmful. Then I would not be here now and you would not be reading this message.
    Nevertheless, if you can't satisfy yourself that these instructions are safe, don't follow them. Ask for other options.
    4. Here's a summary of what you need to do, if you choose to proceed:
    ☞ Copy a line of text in this window to the Clipboard.
    ☞ Paste into the window of another application.
    ☞ Wait for the test to run. It usually takes a few minutes.
    ☞ Paste the results, which will have been copied automatically, back into a reply on this page.
    The sequence is: copy, paste, wait, paste again. You don't need to copy a second time. Details follow.
    5. You may have started the computer in "safe" mode. Preferably, these steps should be taken in “normal” mode, under the conditions in which the problem is reproduced. If the system is now in safe mode and works well enough in normal mode to run the test, restart as usual. If you can only test in safe mode, do that.
    6. If you have more than one user, and the one affected by the problem is not an administrator, then please run the test twice: once while logged in as the affected user, and once as an administrator. The results may be different. The user that is created automatically on a new computer when you start it for the first time is an administrator. If you can't log in as an administrator, test as the affected user. Most personal Macs have only one user, and in that case this section doesn’t apply. Don't log in as root.
    7. The script is a single long line, all of which must be selected. You can accomplish this easily by triple-clicking anywhere in the line. The whole line will highlight, though you may not see all of it in the browser window, and you can then copy it. If you try to select the line by dragging across the part you can see, you won't get all of it.
    Triple-click anywhere in the line of text below on this page to select it:
    PATH=/usr/bin:/bin:/usr/sbin:/sbin:/usr/libexec;clear;cd;p=(Software Hardware Memory Diagnostics Power FireWire Thunderbolt USB Fonts SerialATA 4 1000 25 5120 KiB/s 1024 85 \\b%% 20480 1 MB/s 25000 ports ' com.clark.\* \*dropbox \*genieo\* \*GoogleDr\* \*k.AutoCAD\* \*k.Maya\* vidinst\* ' DYLD_INSERT_LIBRARIES\ DYLD_LIBRARY_PATH -86 "` route -n get default|awk '/e:/{print $2}' `" 25 N\\/A down up 102400 25600 recvfrom sendto CFBundleIdentifier 25 25 25 1000 MB com.apple.AirPortBaseStationAgent 464843899 51 5120 files );N5=${#p[@]};p[N5]=` networksetup -listnetworkserviceorder|awk ' NR>1 { sub(/^\([0-9]+\) /,"");n=$0;getline;} $NF=="'${p[26]}')" { sub(/.$/,"",$NF);print n;exit;} ' `;f=('\n%s: %s\n' '\n%s\n\n%s\n' '\nRAM details\n%s\n' %s\ %s '%s\n-\t%s\n' );S0() { echo ' { q=$NF+0;$NF="";u=$(NF-1);$(NF-1)="";gsub(/^ +| +$/,"");if(q>='${p[$1]}') printf("%s (UID %s) is using %s '${p[$2]}'",$0,u,q);} ';};s=(' s/[0-9A-Za-z._]+@[0-9A-Za-z.]+\.[0-9A-Za-z]{2,4}/EMAIL/g;/\/Shared/!s/(\/Users\/)[^ /]+/\1USER/g;s/[-0-9A-Fa-f]{22,}/UUID/g;' ' s/^ +//;/de: S|[nst]:/p;' ' {sub(/^ +/,"")};/er:/;/y:/&&$2<'${p[10]} ' 1s/://;3,6d;/[my].+:/d;s/^ {4}//;H;${ g;s/\n$//;/s: [^EO]|x([^08]|02[^F]|8[^0])/p;} ' ' 5h;6{ H;g;/P/!p;} ' ' ($1~/^Cy/&&$3>'${p[11]}')||($1~/^Cond/&&$2!~/^N/) ' ' /:$/{ N;/:.+:/d;s/ *://;b0'$'\n'' };/^ *(V.+ [0N]|Man).+ /{ s/ 0x.... //;s/[()]//g;s/(.+: )(.+)/ (\2)/;H;};$b0'$'\n'' d;:0'$'\n'' x;s/\n\n//;/Apple[ ,]|Genesy|Intel|SMSC/d;s/\n.*//;/\)$/p;' ' s/^.*C/C/;H;${ g;/No th|pms/!p;} ' '/= [^GO]/p' '{$1=""};1' ' /Of/!{ s/^.+is |\.//g;p;} ' ' $0&&!/ / { n++;print;} END { if(n<200) print "com.apple.";} ' ' $3~/[0-9]:[0-9]{2}$/ { gsub(/:[0-9:a-f]{14}/,"");} { print|"tail -n'${p[12]}'";} ' ' NR==2&&$4<='${p[13]}' { print $4;} ' ' END { $2/=256;if($2>='${p[15]}') print int($2) } ' ' NR!=13{next};{sub(/[+-]$/,"",$NF)};'"`S0 21 22`" 'NR!=2{next}'"`S0 37 17`" ' NR!=5||$8!~/[RW]/{next};{ $(NF-1)=$1;$NF=int($NF/10000000);for(i=1;i<=3;i++){$i="";$(NF-1-i)="";};};'"`S0 19 20`" 's:^:/:p' '/\.kext\/(Contents\/)?Info\.plist$/p' 's/^.{52}(.+) <.+/\1/p' ' /Launch[AD].+\.plist$/ { n++;print;} END { print "'${p[41]}'";if(n<200) print "/System/";} ' '/\.xpc\/(Contents\/)?Info\.plist$/p' ' NR>1&&!/0x|\.[0-9]+$|com\.apple\.launchctl\.(Aqua|Background|System)$|'${p[41]}'/ { print $3;} ' ' /\.(framew|lproj)|\):/d;/plist:|:.+(Mach|scrip)/s/:[^:]+//p ' '/^root$/p' ' !/\/Contents\/.+\/Contents|Applic|Autom|Frameworks/&&/Lib.+\/Info.plist$/ { n++;print;} END { if(n<1100) print "/System/";} ' '/^\/usr\/lib\/.+dylib$/p' ' /Temp|emac/{next};/(etc|Preferences|Launch[AD].+)\// { sub(".(/private)?","");n++;print;} END { print "'${p[41]}'.plist\t'${p[42]}'";if(n<500) print "Launch";} ' ' /\/(Contents\/.+\/Contents|Frameworks)\/|\.wdgt\/.+\.([bw]|plu)/d;p;' 's/\/(Contents\/)?Info.plist$//;p' ' { gsub("^| |\n","\\|\\|kMDItem'${p[35]}'=");sub("^...."," ") };1 ' p '{print $3"\t"$1}' 's/\'$'\t''.+//p' 's/1/On/p' '/Prox.+: [^0]/p' '$2>'${p[43]}'{$2=$2-1;print}' ' BEGIN { i="'${p[26]}'";M1='${p[16]}';M2='${p[18]}';M3='${p[31]}';M4='${p[32]}';} !/^A/{next};/%/ { getline;if($5<M1) a="user "$2"%, system "$4"%";} /disk0/&&$4>M2 { b=$3" ops/s, "$4" blocks/s";} $2==i { if(c) { d=$3+$4+$5+$6;next;};if($4>M3||$6>M4) c=int($4/1024)" in, "int($6/1024)" out";} END { if(a) print "CPU: "a;if(b) print "I/O: "b;if(c) print "Net: "c" (KiB/s)";if(d) print "Net errors: "d" packets/s";} ' ' /r\[0\] /&&$NF!~/^1(0|72\.(1[6-9]|2[0-9]|3[0-1])|92\.168)\./ { print $NF;exit;} ' ' !/^T/ { printf "(static)";exit;} ' '/apsd|BKAg|OpenD/!s/:.+//p' ' (/k:/&&$3!~/(255\.){3}0/ )||(/v6:/&&$2!~/A/ ) ' ' $1~"lR"&&$2<='${p[25]}';$1~"li"&&$3!~"wpa2";' ' BEGIN { FS=":";p="uniq -c|sed -E '"'s/ +\\([0-9]+\\)\\(.+\\)/\\\2 x\\\1/;s/x1$//'"'";} { n=split($3,a,".");sub(/_2[01].+/,"",$3);print $2" "$3" "a[n]$1|p;b=b$1;} END { close(p);if(b) print("\n\t* Code injection");} ' ' NR!=4{next} {$NF/=10240} '"`S0 27 14`" ' END { if($3~/[0-9]/)print$3;} ' ' BEGIN { L='${p[36]}';} !/^[[:space:]]*(#.*)?$/ { l++;if(l<=L) f=f"\n   "$0;} END { F=FILENAME;if(!F) exit;if(!f) f="\n   [N/A]";"file -b "F|getline T;if(T!~/^(AS.+ (En.+ )?text$|(Bo|PO).+ sh.+ text ex)/) F=F" ("T")";printf("\nContents of %s\n%s\n",F,f);if(l>L) printf("\n   ...and %s more line(s)\n",l-L);} ' ' s/^ ?n...://p;s/^ ?p...:/-'$'\t''/p;' 's/0/Off/p' ' END{print NR} ' ' /id: N|te: Y/{i++} END{print i} ' ' / / { print "'"${p[28]}"'";exit;};1;' '/ en/!s/\.//p' ' NR!=13{next};{sub(/[+-M]$/,"",$NF)};'"`S0 39 40`" ' $10~/\(L/&&$9!~"localhost" { sub(/.+:/,"",$9);print $1": "$9;} ' '/^ +r/s/.+"(.+)".+/\1/p' 's/(.+\.wdgt)\/(Contents\/)?Info\.plist$/\1/p' 's/^.+\/(.+)\.wdgt$/\1/p' ' /l: /{ /DVD/d;s/.+: //;b0'$'\n'' };/s: /{ /V/d;s/^ */- /;H;};$b0'$'\n'' d;:0'$'\n'' x;/APPLE [^:]+$/d;p;' ' /^find: /d;p;' "`S0 44 45`" ' BEGIN{FS="= "} /Path/{print $2} ' ' /^ *$/d;s/^ */   /;' );c1=(system_profiler pmset\ -g nvram fdesetup find syslog df vm_stat sar ps sudo\ crontab sudo\ iotop top pkgutil 'PlistBuddy 2>&1 -c "Print' whoami cksum kextstat launchctl sudo\ launchctl crontab 'sudo defaults read' stat lsbom mdfind ' for i in ${p[24]};do ${c1[18]} ${c2[27]} $i;done;' defaults\ read scutil sudo\ dtrace sudo\ profiles sed\ -En awk /S*/*/P*/*/*/C*/*/airport networksetup mdutil sudo\ lsof test osascript\ -e );c2=(com.apple.loginwindow\ LoginHook '" /L*/P*/loginw*' "'tell app \"System Events\" to get properties of login items'|tr , \\\n" 'L*/Ca*/com.ap*.Saf*/E*/* -d 1 -name In*t -exec '"${c1[14]}"' :CFBundleDisplayName" {} \;|sort|uniq' '~ $TMPDIR.. \( -flags +sappnd,schg,uappnd,uchg -o ! -user $UID -o ! -perm -600 \)' '.??* -path .Trash -prune -o -type d -name *.app -print -prune' :${p[35]}\" :Label\" '{/,}L*/{Con,Pref}* -type f ! -size 0 -name *.plist -exec plutil -s {} \;' "-f'%N: %l' Desktop L*/Keyc*" therm sysload boot-args status " -F '\$Time \$Message' -k Sender kernel -k Message Req 'bad |Beac|caug|corru|dead[^bl]|FAIL|fail|GPU |hfs: Ru|inval|jnl:|last value [1-9]|n Cause: -|NVDA\(|pagin|proc: t|Roamed|rror|ssert|Thrott|tim(ed? ?|ing )o|WARN' -k Message Rne 'Goog|ksadm|SMC:| VALI|xpma' -o -k Sender fseventsd -k Message Req 'SL' " '-du -n DEV -n EDEV 1 10' 'acrx -o comm,ruid,%cpu' '-t1 10 1' '-f -pfc /var/db/r*/com.apple.*.{BS,Bas,Es,J,OSXU,Rem,up}*.bom' '{/,}L*/Lo*/Diag* -type f -regex .\*[cght] ! -name .?\* ! -name \*ag \( -exec grep -lq "^Thread c" {} \; -exec printf \* \; -o -true \) -execdir stat -f:%Sc:%N -t%F {} \;|sort -t: -k2 |tail -n'${p[38]} '/S*/*/Ca*/*xpc* >&- ||echo No' '-L /{S*/,}L*/StartupItems -type f -exec file {} +' '-L /S*/L*/{C*/Sec*A,Ex}* {/,}L*/{A*d,Ca*/*/Ex,Co{mpon,reM},Ex,In{p,ter},iTu*/*P,Keyb,Mail/B,Pr*P,Qu*T,Scripti,Sec,Servi,Spo,Widg}* -path \\*s/Resources -prune -o -type f -name Info.plist' '/usr/lib -type f -name *.dylib' `awk "${s[31]}"<<<${p[23]}` "/e*/{auto,{cron,fs}tab,hosts,{[lp],sy}*.conf,pam.d/*,ssh{,d}_config,*.local} {,/usr/local}/etc/periodic/*/* /L*/P*{,/*}/com.a*.{Bo,sec*.ap}*t {/S*/,/,}L*/Lau*/*t .launchd.conf" list getenv /Library/Preferences/com.apple.alf\ globalstate --proxy '-n get default' -I --dns -getdnsservers\ "${p[N5]}" -getinfo\ "${p[N5]}" -P -m\ / '' -n1 '-R -l1 -n1 -o prt -stats command,uid,prt' '--regexp --only-files --files com.apple.pkg.*|sort|uniq' -kl -l -s\ / '-R -l1 -n1 -o mem -stats command,uid,mem' '+c0 -i4TCP:0-1023' com.apple.dashboard\ layer-gadgets '-d /L*/Mana*/$USER&&echo On' '-app Safari WebKitDNSPrefetchingEnabled' "+c0 -l|awk '{print(\$1,\$3)}'|sort|uniq -c|sort -n|tail -1|awk '{print(\$2,\$3,\$1)}'" );N1=${#c2[@]};for j in {0..9};do c2[N1+j]=SP${p[j]}DataType;done;N2=${#c2[@]};for j in 0 1;do c2[N2+j]="-n ' syscall::'${p[33+j]}':return { @out[execname,uid]=sum(arg0) } tick-10sec { trunc(@out,1);exit(0);} '";done;l=(Restricted\ files Hidden\ apps 'Elapsed time (s)' POST Battery Safari\ extensions Bad\ plists 'High file counts' User Heat System\ load boot\ args FileVault Diagnostic\ reports Log 'Free space (MiB)' 'Swap (MiB)' Activity 'CPU per process' Login\ hook 'I/O per process' Mach\ ports kexts Daemons Agents XPC\ cache Startup\ items Admin\ access Root\ access Bundles dylibs Apps Font\ issues Inserted\ dylibs Firewall Proxies DNS TCP/IP Wi-Fi Profiles Root\ crontab User\ crontab 'Global login items' 'User login items' Spotlight Memory Listeners Widgets Parental\ Controls Prefetching SATA Descriptors );N3=${#l[@]};for i in 0 1 2;do l[N3+i]=${p[5+i]};done;N4=${#l[@]};for j in 0 1;do l[N4+j]="Current ${p[29+j]}stream data";done;A0() { id -G|grep -qw 80;v[1]=$?;((v[1]==0))&&sudo true;v[2]=$?;v[3]=`date +%s`;clear >&-;date '+Start time: %T %D%n';};for i in 0 1;do eval ' A'$((1+i))'() { v=` eval "${c1[$1]} ${c2[$2]}"|'${c1[30+i]}' "${s[$3]}" `;[[ "$v" ]];};A'$((3+i))'() { v=` while read i;do [[ "$i" ]]&&eval "${c1[$1]} ${c2[$2]}" \"$i\"|'${c1[30+i]}' "${s[$3]}";done<<<"${v[$4]}" `;[[ "$v" ]];};A'$((5+i))'() { v=` while read i;do '${c1[30+i]}' "${s[$1]}" "$i";done<<<"${v[$2]}" `;[[ "$v" ]];};';done;A7(){ v=$((`date +%s`-v[3]));};B2(){ v[$1]="$v";};for i in 0 1;do eval ' B'$i'() { v=;((v['$((i+1))']==0))||{ v=No;false;};};B'$((3+i))'() { v[$2]=`'${c1[30+i]}' "${s[$3]}"<<<"${v[$1]}"`;} ';done;B5(){ v[$1]="${v[$1]}"$'\n'"${v[$2]}";};B6() { v=` paste -d: <(printf "${v[$1]}") <(printf "${v[$2]}")|awk -F: ' {printf("'"${f[$3]}"'",$1,$2)} ' `;};B7(){ v=`grep -Fv "${v[$1]}"<<<"$v"`;};C0() { [[ "$v" ]]&&sed -E "$s"<<<"$v";};C1() { [[ "$v" ]]&&printf "${f[$1]}" "${l[$2]}" "$v"|sed -E "$s";};C2() { v=`echo $v`;[[ "$v" != 0 ]]&&C1 0 $1;};C3() { v=`sed -E "${s[63]}"<<<"$v"`&&C1 1 $1;};for i in 1 2;do for j in 0 2 3;do eval D$i$j'(){ A'$i' $1 $2 $3; C'$j' $4;};';done;done;{ A0;D20 0 $((N1+1)) 2;D10 0 $N1 1;B0;C2 27;B0&&! B1&&C2 28;D12 15 37 25 8;A1 0 $((N1+2)) 3;C0;D13 0 $((N1+3)) 4 3;D23 0 $((N1+4)) 5 4;D13 0 $((N1+9)) 59 50;for i in 0 1 2;do D13 0 $((N1+5+i)) 6 $((N3+i));done;D13 1 10 7 9;D13 1 11 8 10;D22 2 12 9 11;D12 3 13 10 12;D23 4 19 44 13;D23 5 14 12 14;D22 6 36 13 15;D22 7 37 14 16;D23 8 15 38 17;D22 9 16 16 18;B1&&{ D22 35 49 61 51;D22 11 17 17 20;for i in 0 1;do D22 28 $((N2+i)) 45 $((N4+i));done;};D22 12 44 54 45;D22 12 39 15 21;A1 13 40 18;B2 4;B3 4 0 19;A3 14 6 32 0;B4 0 5 11;A1 17 41 20;B7 5;C3 22;B4 4 6 21;A3 14 7 32 6;B4 0 7 11;B3 4 0 22;A3 14 6 32 0;B4 0 8 11;B5 7 8;B1&&{ A2 19 26 23;B7 7;C3 23;};A2 18 26 23;B7 7;C3 24;D13 4 21 24 26;B4 4 12 26;B3 4 13 27;A1 4 22 29;B7 12;B2 14;A4 14 6 52 14;B2 15;B6 14 15 4;B3 0 0 30;C3 29;A1 4 23 27;B7 13;C3 30;D13 24 24 32 31;D13 25 37 32 33;A2 23 18 28;B2 16;A2 16 25 33;B7 16;B3 0 0 34;B2 21;A6 47 21&&C0;B1&&{ D13 21 0 32 19;D13 10 42 32 40;D22 29 35 46 39;};D23 14 1 62 42;D12 34 43 53 44;D12 22 20 32 25;D22 0 $((N1+8)) 51 32;D13 4 8 41 6;D12 26 28 35 34;D13 27 29 36 35;A2 27 32 39&&{ B2 19;A2 33 33 40;B2 20;B6 19 20 3;};C2 36;D23 33 34 42 37;B1&&D23 35 45 55 46;D23 32 31 43 38;D12 36 47 32 48;D13 20 42 32 41;D13 37 2 48 43;D13 4 5 32 1;D13 4 3 60 5;D12 26 48 49 49;B3 4 22 57;A1 26 46 56;B7 22;B3 0 0 58;C3 47;D22 4 4 50 0;D23 22 9 37 7;A7;C2 2;} 2>/dev/null|pbcopy;exit 2>&-
    Copy the selected text to the Clipboard by pressing the key combination command-C.
    8. Launch the built-in 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.
    Click anywhere in the Terminal window and paste by pressing command-V. The text you pasted should vanish immediately. If it doesn't, press the return key.
    9. If you see an error message in the Terminal window such as "Syntax error" or "Event not found," enter
    exec bash
    and press return. Then paste the script again.
    10. If you're logged in as an administrator, you'll be prompted for your login password. Nothing will be displayed when you type it. You will not see the usual dots in place of typed characters. Make sure caps lock is off. Type carefully and then press return. You may get a one-time warning to be careful. If you make three failed attempts to enter the password, the test will run anyway, but it will produce less information. In most cases, the difference is not important. If you don't know the password, or if you prefer not to enter it, press the key combination control-C or just press return  three times at the password prompt. Again, the script will still run.
    If you're not logged in as an administrator, you won't be prompted for a password. The test will still run. It just won't do anything that requires administrator privileges.
    11. The test may take a few minutes to run, depending on how many files you have and the speed of the computer. A computer that's abnormally slow may take longer to run the test. While it's running, there will be nothing in the Terminal window and no indication of progress. Wait for the line
    [Process completed]
    to appear. If you don't see it within half an hour or so, the test probably won't complete in a reasonable time. In that case, close the Terminal window and report what happened. No harm will be done.
    12. When the test is complete, quit Terminal. The results will have been copied to the Clipboard automatically. They are not shown in the Terminal window. Please don't copy anything from there. All you have to do is start a reply to this comment and then paste by pressing command-V again.
    At the top of the results, there will be a line that begins with the words "Start time." If you don't see that, but instead see a mass of gibberish, you didn't wait for the "Process completed" message to appear in the Terminal window. Please wait for it and try again.
    If any private information, such as your name or email address, appears in the results, anonymize it before posting. Usually that won't be necessary.
    13. When you post the results, you might see an error message on the web page: "You have included content in your post that is not permitted," or "You are not authorized to post." That's a bug in the forum software. Please post the test results on Pastebin, then post a link here to the page you created.
    14. This is a public forum, and others may give you advice based on the results of the test. They speak only for themselves, and I don't necessarily agree with them.
    Copyright © 2014 by Linc Davis. As the sole author of this work, I reserve all rights to it except as provided in the Use Agreement for the Apple Support Communities website ("ASC"). Readers of ASC may copy it for their own personal use. Neither the whole nor any part may be redistributed.

  • STRANGE PROBLEM with "Create New Mail Account.scpt" when creating POP acct.

    I am using "Create New Mail Account.scpt" to create a POP account. It creates the account successfully. It fetches the mails successfully. Now the problem begins. After fetching all the mails once if u click "Get Mail" in mac mail, it fetches all the emails again and has now 1 original and 1 copy of the email set which is on the server. I just need 1 copy of the mail set not multiple. Please give me a solution or direct me to a help.
    Thanks
    SCRIPT
    global theUsername
    global thePassword
    set success to 1
    set theResult to true
    if theResult is not equal to false
    #set theAccountName to getAccountName()
    #set theUsername to getUsername()
    #set thePassword to getPassword()
    #set theEmailAddresses to getEmailAddress()
    #set theFullName to getFullName()
    -- POP Account
    if accountTypeString is equal to "POP" or accountTypeString is equal to "IMAP" then
    set theHostname to "THE HOST NAME"
    -- POP specific options
    if accountTypeString is equal to "POP" then
    set deletionPolicy to my getDeletionPolicy()
    if deletionPolicy is not equal to false then
    set deletionPolicy to item 1 of deletionPolicy
    set theNewAccount to my createAccount(accountTypeString, theAccountName, theUsername, theHostname, thePassword, theEmailAddresses, theFullName)
    if theNewAccount is not equal to false then
    setDeletionPolicy(theNewAccount, deletionPolicy)
    getAndSetAuthenticationScheme(accountTypeString, theNewAccount)
    getAndSetSMTPServer(theNewAccount)
    else
    set success to 0
    end if
    end if
    -- IMAP specific options
    else if accountTypeString is equal to "IMAP" then
    set theNewAccount to my createAccount(accountTypeString, theAccountName, theUsername, theHostname, thePassword, theEmailAddresses, theFullName)
    if theNewAccount is not equal to false then
    getAndSetCachingSettings(theNewAccount)
    getAndSetAuthenticationScheme(accountTypeString, theNewAccount)
    getAndSetSMTPServer(theNewAccount)
    else
    set success to 0
    end if
    end if
    end if
    if success is equal to 1 then
    display dialog "Account created!"
    else
    display dialog "Account creation failed!"
    end if
    end if
    -- Convenience handler for creating accounts
    on createAccount(theAccountType, theAccountName, theUsername, theHostname, thePassword, theEmailAddresses, theFullName)
    tell application "Mail"
    try
    if theAccountType is equal to ".Mac" then
    set theNewAccount to make new Mac account with properties {name:theAccountName, user name:theUsername, server name:theHostname, password:thePassword, full name:theFullName, email addresses:{theEmailAddresses}}
    else if theAccountType is equal to "IMAP" then
    set theNewAccount to make new imap account with properties {name:theAccountName, user name:theUsername, server name:theHostname, password:thePassword, uses ssl:true, full name:theFullName, email addresses:{theEmailAddresses}}
    else if theAccountType is equal to "POP" then
    set theNewAccount to make new pop account with properties {name:theAccountName, user name:theUsername, server name:theHostname, include when getting new mail:true, password:thePassword, uses ssl:true, full name:theFullName, email addresses:{theEmailAddresses}}
    end if
    on error
    set theNewAccount to false
    end try
    end tell
    return theNewAccount
    end createAccount
    -- Ask the user what they would like to name the account
    on getAccountName()
    repeat
    set theResult to display dialog "What would you like this account to be named?" default answer "Example: My Home Account"
    set theAccountName to text returned of theResult
    if theAccountName does not start with "Example:" then
    exit repeat
    end if
    end repeat
    return theAccountName
    end getAccountName
    -- Ask the user for the user name for their email account
    on getUsername()
    repeat
    set theResult to display dialog "What is your email user name?" default answer "Example: janedoe"
    set theUsername to text returned of the theResult
    if theUsername does not start with "Example:" then
    exit repeat
    end if
    end repeat
    return theUsername
    end getUsername
    -- Ask the user for the password for their email account
    on getPassword()
    set theResult to display dialog "What is the password for this account?" default answer ""
    set thePassword to text returned of theResult
    return thePassword
    end getPassword
    -- Ask the user for the email addresses for their email account
    on getEmailAddress()
    repeat
    set theResult to display dialog "What email address would you like to use for this account?" default answer "Example: [email protected]"
    set theEmailAddress to text returned of theResult
    if theEmailAddress does not start with "Example:" then
    exit repeat
    end if
    end repeat
    return theEmailAddress
    end getEmailAddress
    -- Ask the user for the full name for their email account
    on getFullName()
    repeat
    set theResult to display dialog "What is the full name for this account?" default answer "Example: Steve Smith"
    set theFullName to text returned of theResult
    if (theFullName does not start with "Example:") then
    exit repeat
    end if
    end repeat
    return theFullName
    end getFullName
    -- Convenience handler for asking the user what settings they would
    -- like to have for their special mailboxes. This handler also sets these
    -- values in Mail.
    on getAndSetSpecialMailboxes(theAccount)
    -- Sent messages default to storing locally
    set theResult to display dialog "Would you like to store Sent Messages on the IMAP server?" buttons {"Yes", "No"} default button 2
    log theAccount
    tell application "Mail"
    tell theAccount
    if button returned of theResult is equal to "Yes" then
    set store sent messages on server to true
    else if button returned of theResult is equal to "No" then
    set store sent messages on server to false
    end if
    end tell
    end tell
    -- Drafts default to storing locally
    set theResult to display dialog "Would you like to store Drafts on the IMAP server?" buttons {"Yes", "No"} default button 2
    tell application "Mail"
    tell theAccount
    if button returned of theResult is equal to "Yes" then
    set store drafts on server to true
    else if button returned of theResult is equal to "No" then
    set store drafts on server to false
    end if
    end tell
    end tell
    -- Trash defaults to storing on the IMAP server
    set theResult to display dialog "Would you like to store Deleted Messages on the IMAP server?" buttons {"Yes", "No"} default button 1
    tell application "Mail"
    tell theAccount
    if button returned of theResult is equal to "Yes" then
    set store deleted messages on server to true
    else if button returned of theResult is equal to "No" then
    set store deleted messages on server to false
    end if
    end tell
    end tell
    end getAndSetSpecialMailboxes
    -- Convenience handler for asking the user what IMAP
    -- caching setting they would like to use and configuring
    -- it in Mail.
    on getAndSetCachingSettings(theAccount)
    set theResult to choose from list {"Cache everything", "Cache everything but attachments", "Cache when read", "Don't cache"} ¬
    with prompt "Choose a message caching setting for this account:" default items {"Cache everything"} without multiple selections allowed
    if theResult is not equal to false then
    tell application "Mail"
    tell theAccount
    if (item 1 of theResult is equal to "Cache everything") then
    set message caching to all messages and their attachments
    else if (item 1 of theResult is equal to "Cache everything but attachments") then
    set message caching to all messages but omit attachments
    else if (item 1 of theResult is equal to "Cache when read") then
    set message caching to only messages I have read
    else if (item 1 of theResult is equal to "Don't cache") then
    set message caching to do not keep copies of any messages
    end if
    end tell
    end tell
    end if
    end getAndSetCachingSettings
    -- Convenience handler for asking the user whether they want to use
    -- an already defined SMTP server (if any) or whether they want to
    -- define a new one.
    on getAndSetSMTPServer(theAccount)
    tell application "Mail" to set everySMTPServer to every smtp server
    if ((count of everySMTPServer) > 0) then
    set listOfSMTPServers to {}
    repeat with eachServer in everySMTPServer
    try
    set listOfSMTPServers to listOfSMTPServers & name of eachServer
    end try
    end repeat
    createNewSMTPServer(theAccount)
    else
    createNewSMTPServer(theAccount)
    end if
    end getAndSetSMTPServer
    -- Handler for creating a new SMTP server, if the user has none set up
    -- already or if they choose not to use one of their existing servers.
    on createNewSMTPServer(theAccount)
    set theServerName to "THE SERVER NAME"
    tell application "Mail"
    set theSMTPServer to make new smtp server with properties {server name:theServerName, port:25, uses ssl:true}
    set smtp server of theAccount to theSMTPServer
    end tell
    getAndSetAuthenticationScheme("SMTP", theSMTPServer)
    end createNewSMTPServer
    -- Handler for asking the user what authentication scheme their server supports.
    -- The options are different for POP, IMAP, and SMTP. Unless you are told otherwise,
    -- it's best to leave these at their default settings.
    on getAndSetAuthenticationScheme(accountType, theAccount)
    if accountType is equal to "POP" then
    set theChoices to {"Password", "Kerberos 4", "Kerberos 5", "KPOP", "MD5"}
    set theDefault to {"Password"}
    else if accountType is equal to "IMAP" then
    set theChoices to {"Password", "Kerberos 4", "Kerberos 5", "MD5"}
    set theDefault to {"Password"}
    else if accountType is equal to "SMTP" then
    set theChoices to {"None", "Password", "Kerberos 4", "Kerberos 5", "MD5"}
    set theDefault to {"Password"}
    end if
    set theResult to choose from list theChoices ¬
    with prompt ¬
    "Choose an authentication scheme for this " & accountType & " server. Most servers support 'Password' authentication." default items theDefault without multiple selections allowed
    if theResult is not equal to false then
    tell application "Mail"
    set theScheme to item 1 of theResult
    tell theAccount
    if theScheme is equal to "Password" then
    set authentication to password
    else if theScheme is equal to "Kerberos 4" then
    set authentication to «constant exutaxk4»
    else if theScheme is equal to "Kerberos 5" then
    set authentication to kerberos 5
    else if theScheme is equal to "MD5" then
    set authentication to md5
    else if theScheme is equal to "None" then
    set authentication to none
    else if theScheme is equal to "KPOP" then
    set authentication to «constant exutakpo»
    end if
    end tell
    end tell
    if accountType is equal to "SMTP" then
    set theSMTPLogin to theUsername
    set theSMTPPassword to thePassword
    tell application "Mail"
    tell theAccount
    set user name to theSMTPLogin
    set password to theSMTPPassword
    set uses ssl to true
    set port to 25
    end tell
    end tell
    end if
    end if
    end getAndSetAuthenticationScheme
    -- Handler for asking the user what POP deletion policy
    -- they would like to use for their account.
    on getDeletionPolicy()
    set theResult to choose from list {"Immediately after being downloaded", "After a specified number of days", ¬
    "When I remove them from the inbox", "Always leave them on the server"} ¬
    with prompt ¬
    "Choose a POP message deletion option:" default items {"Always leave them on the server"} without multiple selections allowed
    return theResult
    end getDeletionPolicy
    -- Handler for setting the deletion policy established in getDeletionPolicy()
    on setDeletionPolicy(theAccount, thePolicy)
    tell application "Mail"
    tell theAccount
    if thePolicy is equal to "Immediately after being downloaded" then
    set delete mail on server to true
    set delayed message deletion interval to 0
    else if thePolicy is equal to "After a specified number of days" then
    set numberOfDays to my getDeletionInterval()
    set delete mail on server to true
    set delayed message deletion interval to numberOfDays
    else if thePolicy is equal to "When I remove them from the inbox" then
    set delete mail on server to true
    set delete messages when moved from inbox to true
    else if thePolicy is equal to "Always leave them on the server" then
    set delete mail on server to false
    end if
    end tell
    end tell
    end setDeletionPolicy
    -- Handler for asking the user what deletion interval they
    -- would like to use, if they are setting up a POP account
    on getDeletionInterval()
    set theResult to display dialog "After how many days would you like POP messages to be deleted from the server?" default answer "30"
    set numberOfDays to text returned of theResult as integer
    return numberOfDays
    end getDeletionInterval

    Hi amiaba, and a warm welcome to the forums!
    I can't quite tell what it's doing, but open Keychain Access in Applications>Utilities, click on your Keychain on the left, put .mac in the search bar, once you find it, double click on it and click show password.
    If you have no mail in there try this with Mail quit.
    Drag this file to the Desktop...
    /Users/YourUserName/Library/Preferences/com.apple.mail.plist
    Start Mail & see if it steps you through it.
    Not sure on the .uk thing, but is Date & Time>Time Zone set to the UK?

  • No sound on new mail

    I have done some research and found this (http://discussions.apple.com/thread.jspa?messageID=10762187&#10762187) but alas, my problem is different.
    Ok, this is what I see...
    * in Mail, I open Preferences > General and have "Ping" set for "New mail sound". (it's slightly louder than the default sound, but it doesn't matter which sound I use, it doesn't work
    * "Dock unread count" = "Inbox Only" (see below)
    I am using an IMAP account to a server I run locally. There are folders that appear under Inbox and at the present time non of them have any badges indicating new mail. Under the account (further down) where there are top level mail boxes there are several folders with badges indicating the unread count....
    All looks good so far, then this is where the problem lies...
    When I receive new mail, the badge on the mail application in the dock comes up, but no sound comes up. That badge relates directly to the inbox and new mail. But INSIDE the mail application, no matter what I do, I can not get an unread mail badge on the inbox itself. I can have any number of new mail in the inbox root, and I can see them unread (bolded) on the right side of the screen, but there is no unread count on the inbox itself (and for whatever reason this is where I think the sound alert is linked to. Because this badge is not showing up, I not get sound. It's just a hunch, but I think I'm on the game
    BTW before anyone asks, yes, my sound is turned on and not muted.
    What am I missing???

    I have found a work around, but it doesn't always work.
    My processes thus far: I opened up Mail on a Snow Leopard and IMAP'd into the same mail account and the badge was located on the inbox. Sure enough, it sounds everytime new mail is received.
    The ONLY way I can get the badge to appear on the main inbox, is to have mail monitor SEVERAL mail accounts. When I added a second IMAP account, the inbox suddenly had an unread count badge. Thinking my problem was solved, I deleted the second account and along with it, the badge also disappeared. I re-entered the account and it's back.
    As I said, it still doesn't always sound for new mail, but it does sound MORE often. I'm not going to mark this as resolved, since I feel this is still a problem

  • Export addresses from ipad to new mail account

    Become a legend and solve this one question.
    My father in law (89 years old) has an iPad (two years old).
    No computer no nothing, only an iPad.
    The iPad is connected to an e-mail adress (iCloud).
    We can not access the e-mail address (too long a story).
    We want to connect the iPad and iCloud to a new address but that is not possible (i think) without erasing the whole content of the iPad.
    If we erase and start all over again he will loose his addressbook.....
    So how do we export the addresses currently on the iPad to his new Gmail address (that is not yet connected to the iPad).
    So that after exporting we can simply erase the iPad and start all over again and link it to his new mail address.
    Hope to hear from you and thank you for your efforts here (and hopefully on this one too...)
    Regards,
    Henk.

    Your system admin should be more interested in the long message headers for all junk messages received since most reveal the sender's computer IP address which can and should be blocked at the server instead of the email addresses.
    Since spammers don't provide a valid sending or return email address and are constantly changing the phony email address that appears as the sending address, building a blacklist file based on these phony email addresses only is like a dog chasing his tail IMO.
    There is a script available included with a collection of AppleScripts that can do so but this script adds addresses found in the selected messages (in the header fields "From", "To", "Cc", and "Bcc") to the Address Book which can be exported and then removed from the Address Book if you are interested.

Maybe you are looking for

  • Connecting to an external display

    I have a new black macbook and i bought the Mini dvi to dvi cord through apple. My problem is that the cord is like 4 inches long!! How am I supposed to connect it to the back of my LG display and my macbook with having the macbook hang in the air? I

  • Can download but not install Adobe Reader on Mac OS X 10.4.11

    I have downloaded both Adobe Reader 9 and 8, and tried to install them on my Mac. I have chosen the versions that go with my OS X 10.4.11. When I dubbleclick on the icon for the 8 version, I am told it cannot be opened, because the system doesn't sup

  • Java.lang.NullPointerException, msg=null - Help

    500 Internal Server Error JBO-30003: The application pool (oracle.srtutorial.datamodel.SRPublicServiceLocal) failed to checkout an application module due to the following exception:oracle.jbo.JboException: JBO-29000: Unexpected exception caught: java

  • RSS Table View with Tab Bar Code Error

    I created an iphone app with a navigation controller that has a table view which displays an rss feed. My client wants it able to display multiple rss feeds through a tab bar. I have attempted several times and have messed up. If anyone could help me

  • SO Wait causes exception occurred within external code called by call library node

    when trying to run some old code that used to work ok, i now get this error message: exception occurred within external code called by call library node and the vi flagged as calling the exception is SO Wait. the error occurs with different soundcard