Slashdot Mirror


Deleting SMTP Servers from Mail.app in Mac OS X?

jesse12345 asks: "Here's probably an easy one for you Unix masters. I travel a fair amount and use Mail in OS X. I'm always using lots of outgoing mail servers. What I can't figure out is how to delete outdated ones. There seems to be no GUI for this within the Mail.app. Is there some way to do this in UNIX?"

17 of 69 comments (clear)

  1. Easy to do in Panther by theWrkncacnter · · Score: 5, Informative

    Its VERY easily done within the GUI of Mail.app in Panther. In the accounts section of preferences there's a "Outgoing mail server" drop down menu that has "Edit Server List" as one of the options that allows you to remove an SMTP server. I'm not sure if this is the same in Jag but I'd imagine so. Hardly seems like a story to me.

    --
    -1 (Troll) is antihammer
    1. Re:Easy to do in Panther by johram · · Score: 2, Informative

      This feature is not present in jaguar.
      Software updates are tied to OS updates as far as the free digital lifestyle iApps are concerned.

      As long as security updates are available to all OS's I don't think thats a problem.

      --
      "Fighting for peace is like fucking for chastity."
    2. Re:Easy to do in Panther by __aafkqj3628 · · Score: 4, Informative

      In that case, here is some "Apple Sample Code" -

      Manage SMTP Servers.scpt

      (*
      Manage SMTP Servers

      Copyright (C) 2002 Apple Computer, Inc.

      You may incorporate this Apple sample code into your program(s) without
      restriction. This Apple sample code has been provided "AS IS" and the
      responsibility for its operation is yours. You are not permitted to
      redistribute this Apple sample code as "Apple sample code" after having
      made changes. If you're going to redistribute the code, we require
      that you make it clear that the code was descended from Apple sample
      code, but that you've made changes.
      *)

      (*
      This script goes through each smtp server, checks to see whether they are
      being used by an account, then presents a list of 'orphaned' smtp servers,
      which you can choose to delete if you wish.
      *)

      tell application "Mail" to set everySMTPServer to every smtp server
      set nameOfEverySMTPServer to {}
      repeat with eachSMTPServer in everySMTPServer
      if (my isThisSMTPServerBeingUsed(eachSMTPServer)) then
      -- Don't add to the list of smtp servers to potentially delete
      -- if the server is actively being used by an account
      else
      set nameOfEverySMTPServer to nameOfEverySMTPServer & name of eachSMTPServer
      end if
      end repeat
      if ((count of nameOfEverySMTPServer) is equal to 0) then
      display dialog "All the SMTP servers you have defined are being used by active accounts."
      else
      set theServersToDelete to choose from list nameOfEverySMTPServer with prompt "Choose one or more SMTP servers to delete. None of these servers are currently being used by any of your email accounts." with multiple selections allowed
      if theServersToDelete is not equal to false then
      if ((count of theServersToDelete) is greater than 0) then
      repeat with eachServer in theServersToDelete
      repeat with eachSMTPServer in everySMTPServer
      try
      if (name of eachSMTPServer is equal to eachServer as string) then
      tell application "Mail" to delete eachSMTPServer
      end if
      end try
      end repeat
      end repeat
      display dialog "The selected servers have been deleted!"
      end if
      end if
      end if

      on isThisSMTPServerBeingUsed(theServer)
      -- Run through each account and see if any of them
      -- are using the given SMTP server
      set theResult to false
      tell application "Mail"
      set everyAccount to every account
      repeat with eachAccount in everyAccount
      set nameOfSMTPServer to name of smtp server of eachAccount
      try
      if (nameOfSMTPServer is equal to name of theServer) then
      set theResult to true
      end if
      end try
      end repeat
      end tell
      return theResult
      end isThisSMTPServerBeingUsed

  2. There's an AppleScript for it by Colitis · · Score: 4, Informative

    Try: /Applications/AppleScript/Example\ Scripts/Mail\ Scripts/Manage\ SMTP\ Servers.scpt

    Seemed to work for me OK.

    1. Re:There's an AppleScript for it by Bloodmoon1 · · Score: 2, Informative

      Also (in both 10.2.x and 10.3.x): Library/Scripts/Mail Scripts/Manage SMTP Servers.scpt

      --

      Request: ECM unit, 1000 km fullerene cable, 1 tactical nuclear weapon. Reason: Birthday party for foreign dignitary.
    2. Re:There's an AppleScript for it by Anonymous Coward · · Score: 1, Informative

      http://docs.info.apple.com/article.html?artnum=107 425

  3. Howto: by moofbong · · Score: 4, Informative

    Edit the file "com.apple.mail.plist" in ~/Library/Preferences. There is a key in the XML called DeliveryAccounts (just search for it in your favorite text editor). Immediately beneath it, there is an array with tags. Just remove the whole ... </dict> section that corresponds to the SMTP server and you should be all set. Probably should close Mail before doing this. Maybe make a backup of your preference file too, just in case. ;)

    --

    ~moofbong

    If 'con' is the opposite of 'pro', what is the opposite of 'progress'?

  4. Try the "Remove Server" button by Tor · · Score: 1, Informative
    At least in Mac OS X 10.3 (Panther):
    • Mail -> Preferences -> Accounts -> [account name] -> Account Information
    • From the "Outgoing Mail Server (SMTP):" pull-down list, select "Edit Server List...".
    • Select the server(s) you wish to remove, then press the "Remove Server" button.

  5. yes by jcbphi · · Score: 2, Informative

    Open your favorite text editor (or the plist editor included with the OS X dev tools), and have a go at:

    ~/Library/Preferences/com.apple.mail.plist

    In this file, there is a key labeled "DeliveryAccounts". This is where all your SMTP account information is kept. You should be able to edit/delete any account from there.

    There is a means of doing this through AppleScript as well, but I don't remember how that works, so I'll have to leave that as an exercise for the reader.

    1. Re:yes by Daniel+Dvorkin · · Score: 2, Informative

      Actually, if you double-click on this (or any) .plist file -- or go there through the Terminal and type "open FILENAME" where FILENAME is the name of the .plist file -- it will open in Property List Editor, which is designed explicitly for this kind of management. It takes some playing around with this app to get comfortable in it (ALWAYS BACK UP!) but once you do, it's a powerful and convenient tool.

      --
      The correlation between ignorance of statistics and using "correlation is not causation" as an argument is close to 1.
  6. Yeah by Hanji · · Score: 1, Informative

    I've had this same problem, and it really pissed me off for a while.

    Fortunately, Panther seems to have fixed this - in account prefs, the SMTP server dropdown has added a "Edit Servers" Option. If you're still in Jaguar, however, I believe you can kill servers by editing ~/Library/Preferences/com.apple.mail.plist. I managed this once in Jaguar, but I'm too lazy to try to figure out which entries to trash now. I'm pretty sure it's in there somewhere, though.

    --
    A Minesweeper clone that doesn't suck
  7. Re:Wow by standsolid · · Score: 2, Informative

    oh my god, I foudn the answer in 20 seconds on google... not even newsgroups
    http://email.about.com/cs/macosxmailtips/a/et01270 3.htm
    since when is slashdot "I'm too lazy to use GOOGLE" tech support. goddammit.

    --
    WTPOUAWYHTTOTWPA
    What's the point of using acronyms when you have to type out the whole phrase anyways?
  8. Re:Use Sendmail by shamino0 · · Score: 2, Informative
    Don't some ISPs break this?

    Many ISP's (including Earthlink, which I use) block access to port 25 - meaning you can't send directly to a remote mail server. As a part of this, they tell you that all outbound mail must go through thair provided mail server.

    This is an anti-spam procedure that works well. If all of their customers must send mail through a single server, that server can filter and block those customers that have abused their mail privileges. In other words, these blocks are (for the most part) a good thing.

    But this doesn't rule out running your own internal mail server. You just have to configure it to relay all outbound mail (that is, everything leaving your LAN) through your ISP's mail server instead of sending directly to the recipient's server. I know that sendmail can be configured to do this (I've done this on my Linux PC in order to allow me to use /usr/ucb/mail.) I would assume that any other halfway decent mail server should be able to do the same thing.

  9. Not possible in Panther by schwanerhill · · Score: 2, Informative

    It was not possible from within the Jaguar GUI. (I submitted a bug report about it to Apple, and am glad to see that they fixed it.)

    The easiest way to remove servers is to edit the Mail preferences file. Open ~/Library/Preferences/com.apple.mail.plist (either in Property List Editor--if you have the developer tools installed--or any text editor) and find the entry "Delivery Accounts". Delete any you don't want.

  10. Re:speaking of mail.app.... by eyeball · · Score: 2, Informative
    I can't remember exactly, but it's somthing like: (BTW, Please be careful -- back up files and tread lightly. if unsure about any of this, verify my advice with experts, online posts, etc.)
    1. you first use openssl to grab the certificate in base64 form like this:
      openssl s_client -showcerts -connect yoursmtpserver.com:465
    2. Copy the base 64 cert section (between and including the 'begin certificate' and 'end certificate') to a file (i.e.:yoursmtpserver.cer).
    3. Next copy /System/Library/Keychains/X509Anchors to your home dir
    4. open the keychain access app
    5. In the file menu, use Add Keychain, and add the X509Anchors in your home directory
    6. make sure the X509Anchors keychain is selected (you should see only certificates listed)
    7. in the file menu, select import, and import your .cer file
    8. delete the keychain (DELETE REFERENCES ONLY), and close keychain access.
    9. copy the X509Anchors back to the original location.


    It's a pain in the neck, but works perfectly for me. This also works for adding self-signed certs and such.
    --

    _______
    2B1ASK1
  11. The AppleScript is best, but in the shell: by Domini · · Score: 2, Informative

    Edit:
    ~/Library/Preferences/com.apple.mail.plist

    And take out the <dict> entries that matches the unused entries...
    <PRE>
    <key>DeliveryAccounts</key>
    <array>
    <dict>
    <key>AccountType</key>
    <string>SMTPAccount</string>
    <key>Hostname</key>
    <string>mail.tbs.co.za</string>
    &nbsp ; <key>ShouldUseAuthentication</key>
    &nbsp ; <string>NO</string>
    </dict>
    </array>
    </PRE>

  12. Applescript: the GUI way!!! by zpok · · Score: 4, Informative

    Go to the folder "../Applications/AppleScript/Example Scripts/Mail Scripts/"

    There you'll find "Manage SMTP Servers.scpt".

    Double-click it and you'll get a nice little window with all SMTP servers you don't use and a button to delete them.

    Cheers,

    --
    I think, therefore I am...I think.