Delete mail from server after receiving

Hello,
after I've received a message from the mail server I want to delete this message on the server. How can I realise this?
Thanks JSCH

Hi,
This is from Sun tutorial.
Go through this. :)
Cheers.
Deleting messages involves working with the Flags associated with the messages. There are different flags for different states, some system-defined and some user-defined. The predefined flags are defined in the inner class Flags.Flag and are listed below:
Flags.Flag.ANSWERED
Flags.Flag.DELETED
Flags.Flag.DRAFT
Flags.Flag.FLAGGED
Flags.Flag.RECENT
Flags.Flag.SEEN
Flags.Flag.USER
Just because a flag exists doesn't mean the flag is supported by all mail servers/providers. For instance, besides deleting messages, the POP protocol supports none of them. Checking for new mail is not a POP task but one built into mail clients. To find out what flags are supported, ask the folder with getPermanentFlags().
To delete messages, you set the message's DELETED flag:
message.setFlag(Flags.Flag.DELETED, true);
Open up the folder in READ_WRITE mode first though:
folder.open(Folder.READ_WRITE);
Then, when you are done processing all messages, close the folder, passing in a true value to expunge the deleted messages.
folder.close(true);
There is an expunge() method of Folder that can be used to delete the messages. However, it doesn't work for Sun's POP3 provider. Other providers may or may not implement the capabilities. It will more than likely be implemented for IMAP providers. Because POP only supports single access to the mailbox, you have to close the folder to delete the messages with Sun's provider.
To unset a flag, just pass false to the setFlag() method. To see if a flag is set, check with isSet().

Similar Messages

  • Delete mail from server after removed from IN BOX

    I have a mail management issue I have not been able to fully solve.
    I am balancing the same POP email accounts among the laptop using Mail (for home use) and my desktop using Eudora Pro (for work). Using Eudora, I can manually select to delete a message from the server. Eudora's manual deletions are flawless. Using Mail, the only option I can see that will help me do this is to select delete mail "When moved from In Box." If I hit the "delete" key, wouldn't that be the same as "moving if from the IN BOX?" When is the protocol actually carried out? On the next mail check? Immediately? Upon quitting and restarting Mail? I'm confused as to how this happens and why it does not seem to work all of the time.
    Any and all assistance is most appreciated.
    Much obliged,
    Mick

    Yes, deleting a message counts as moving it out of
    the inbox. The commands to remove the message from
    the server are sent the next time you check mail from
    that server, but only if there are new messages to be
    received from the server. Yes, many of us feel that
    is a bug in Mail, that it should send the remove from
    server commands the next time you check mail, whether
    or not there are new messages to be downloaded.
    Oh Gawd, I bet that's it. Yes, if that is the case, I would agree. It does not lead to efficient mail management if there needs to be a new message there. Do you know of any plans to change or alter that? Or has someone written an AppleScript of some kind to execute the command regardless?
    It's a great command, otherwise. It's nice to be able to delete a message off of one computer and have it delete off of the server without any extra hassle.
    Just wondering if there are any workarounds out there other than sending oneself a new message to get the delete from server command to activate.
    cheers,
    Mick

  • Delete mail from server

    I use a pop3 account for mail. Can I set up the mail program to delete mail from server when I delete mail locally?

    Not precisely. You can set it to delete when when you move a message from the Inbox which should have the same effect in most cases, but I haven't tested it to make sure. 
    Mail -> Accounts -> Your POP account. Go to the Advanced pane and check the box that says "remove copy from server after retrieving a message" and make the appropriate setting in the pulldown.
    Regards.

  • Delete mail from server when deleting from mail

    I like Mail.
    But - the ONE feature I miss from Entourage is this:
    Delete mail from server when deleting the trash
    Mail can be set to delete messages from the server -- after downloading to the local computer. OK - BUT - I read my email from 3 computers. I want to keep the messages on the server - unless I delete them after trashing - and to read them on 3 computers.
    The BEST way is to delete when I trash them -- NOT when I read them.
    Using the mail program to see all messages on the server and to then delete them one-by-one is a major PITA.
    How can I tell Apple to add this feature?
    Dick
    Dual 2.7 G5, intel iMac, 3 G4 Macs, 2 iPods   Mac OS X (10.4.6)  

    Use the "When moved from Inbox" option that should do it. If you trash it then it goes, if you move it goes... HTH
    Siberian

  • The past few days my Mail app has started downloading multiple copies of e-mails from all pop servers.  This is only happening on my Macbook not other macs.  Deleting mail from server does not help. I ran ClamXav found 2 viruses deleted problem continues

    opps.  Long title there... The past few days my Mail app has started downloading multiple copies of e-mails from all pop servers.  This is only happening on my Macbook not other macs.  Deleting mail from server does not help. I ran ClamXav found 2 viruses deleted those.  Checked for software update and installed suggested downloads.  Problem still contintues.  Any suggestions?

    Folks,
    even after having repaired the inbox folder under "properties" a few times, I still had some e-mails where the contents are different from the subject line.
    In other words in the inbox there are two e-mails: one with subject line "abc", and another one with subject line "def".
    When I display the e-mail with the subject line "abc", the contents are from the e-mail with the subject line "def" in the in-basket.
    What else can be done to correct this problem?
    Thanks and best regards.
    Fred Kunz-Shirzad
    Chemin Ronzeures 6A
    1297 Founex VD
    Switzerland
    [email protected]

  • Delete emails from server after retrieving with IMAP protocol?

    Hi,
    I am using Mail as my email program and have set up my account with IMAP.
    When I use the POP protocol, I get the option to 'Remove copy from server after retrieving message'. When I set up Mail with the IMAP protocol, there is no such an option. The result is that my server inbox is slowly filling up and I manually have to login on my server to delete older messages.
    Is there a setting to automatically remove retrieved messages from my email server using IMAP?
    Thanks for your help.
    Erik

    Dear Thomas,
    Thanks for the clarification! Now I understand the mechanism.
    Still I would like to know if there is a way to automatically remove retrieved messages from the e-mail server. Would it help to automatically move my incoming messages in INBOX to a different mailbox in Mail.app? How would I set this up?
    Thanks for the response!
    Erik

  • Delete mail from server when removed from inbox

    I have a POP e-mail account set up. Under the mail account advanced settings there is an option to delete mail from the server when I delete it from the iPad inbox. I assume this is a valid option for the account since it is shown, and it is what I would like to do. However it doesn't appear to be working. Is this truly an available option?

    I also have a POO account wit ph Verizon and experienced the same thing. Apple tech said that is a property of POP accounts and I would have to change the account to Imap for the iPad to be able to delete from the server.

  • Delete mail from server using ipad not computer

    How do I delete mail from the server using my Ipad 

    That completely depends on your email service provider.
    For gmail, for example, you would do this as follows:
    Settings > Mail, Contacts, Calendars > [your gmail account] > Advanced > [Move Discarded Messages Into] Deleted Mailbox

  • IPhone deleting mail from server without permission?

    Hi,
    About 3 weeks ago mail which is delivered to my Iphone started to disappear from my mail account. Now I have my Iphone set to never delete mail from the server, yet it appears that some, not all are getting deleted.
    I have read some posts which say to delete the mail account from my phone and re-create it which I have already done, but this did not solved my problem. It is a pop account so I'm confused as to why this is happening.
    Any help greatly appreciated.

    I have Deleted Messages under Advanced set to Never, but do not have anything available to change about Server settings under Incoming settings - just SSL, Authentication, IMAP Path Prefix, and Server Port.
    As already provided, this is an IMAP account.
    All server stored mailboxes with an IMAP account are kept synchronized with the server automatically with each email client used to access the account. You can select to store the account's Drafts, Trash, and Sent mailboxes on the server or locally, but the account's Inbox mailbox is stored on the server and cannot be changed.
    When deleting a message from the account's Inbox mailbox with an IMAP account, the message is removed from the account's Inbox mailbox on the server and transferred to the account's Trash mailbox. This will be reflected automatically when checking the account's Inbox mailbox with the email client used on your computer for accessing the account since all server stored mailboxes with an IMAP account are kept synchronized with the server automatically with each email client used to access the account.
    If you have the account's Trash mailbox set to be stored locally, you can try transferring the messages from the account's Trash mailbox back to the account's Inbox mailbox so these messages will be available when accessing the account's Inbox mailbox with the email client on your computer.

  • IPhone not deleting mail from server

    I realise that this appears to be a recurring problem, but I haven't found a post with an outright solution.
    The problem I have is with the the 2 POP accounts. the MobileMe account works fine.
    On the phone, I have it set to remove mail from server when moved from the inbox. Unfortunately this does not occur and sure enough the mail reappears on my Mac. I've tried setting the 2 accounts on the Mac to mimic the setting on the iPhone (currently the accounts are set to delete right away) but this also does not work.
    Any suggestions are greatly appreciated, thanks.
    Leonardo

    I have Deleted Messages under Advanced set to Never, but do not have anything available to change about Server settings under Incoming settings - just SSL, Authentication, IMAP Path Prefix, and Server Port.
    As already provided, this is an IMAP account.
    All server stored mailboxes with an IMAP account are kept synchronized with the server automatically with each email client used to access the account. You can select to store the account's Drafts, Trash, and Sent mailboxes on the server or locally, but the account's Inbox mailbox is stored on the server and cannot be changed.
    When deleting a message from the account's Inbox mailbox with an IMAP account, the message is removed from the account's Inbox mailbox on the server and transferred to the account's Trash mailbox. This will be reflected automatically when checking the account's Inbox mailbox with the email client used on your computer for accessing the account since all server stored mailboxes with an IMAP account are kept synchronized with the server automatically with each email client used to access the account.
    If you have the account's Trash mailbox set to be stored locally, you can try transferring the messages from the account's Trash mailbox back to the account's Inbox mailbox so these messages will be available when accessing the account's Inbox mailbox with the email client on your computer.

  • How can I create a POP3 account on my iPad for Live Mail which doesn't delete mail from server?

    Got a new iPad Air with iOS 7.1.1 tried to create a mail account just like the one on my iPhone 5. I selected 'Other' as mail account which allows me to edit the POP3 and SMTP settings. Think it sends mail ok need to check out receiving BUT there is no longer the option under INCOMING MAIL which says 'Delete from Server' which I have on my iPhone set to 'Never'.
    Anyone know how or what settings to use for the iPad?
    Thanks

    Yes, you're correct this is only for existing users so if you don't have a Gmail account then do as shldr2thewheel suggested.
    You'll then be able to link up to your Gmail account in your iPad once done.
    Regards,
    Steve

  • Delete message from server after download.

    Hi, I'm normally use to Gmail and so haven't used an email client in years.
    I have a .mac account and Mail is setup to check it.
    At the moment, when mail downloads new mail from the server, it still leaves a copy of the email(s) on the server.
    Instead what I would like it to do is, download from the server and then delete the copy on the server.
    ... is this possible?... and how do I do it?
    I'd appreciate any help at all.
    Nick.
    iMac 24inch   Mac OS X (10.4.8)   2.33Ghz Intel Core Duo / 3GB DDR2 SDRAM / 250GB HD / NVIDIA GeForce 7600GT 256MB

    Hello Nick.
    If this is for your .Mac account, a .Mac type account is really an IMAP type account and behaves in the same way.
    You can create/access a .Mac account with the Mail.app as a .Mac, IMAP or POP type account and as an IMAP or POP type account with other email clients.
    If you plan on accessing your .Mac account with another email client or via webmail access on another computer, you may want to reconsider.
    If not, to change the account type of an existing account with the Mail.app requires deleting and recreating the account.
    If you want to save any sent messages with the account before doing so, create an "On My Mac" location mailbox and transfer all existing sent messages from the account's Sent mailbox to the user created "On My Mac" location mailbox. Deleting an account has no affect on messages that remain on the server.
    Delete and re-create your .Mac account selecting POP as the account type when re-creating the account.
    After doing so, go to Mail > Preferences > Accounts and under the Advanced tab for the account preferences will be the available settings for removing messages from the server when downloaded.

  • Delete Mail From Server Gmail-Imap-Account

    Hi,
    My problem is that when I delete email from the z10 it Doesnt delete it from the server
    1. I am use to read my mails from some devices (web,macbook,mobile)
    2. had an ios device before and use to have mails automaticly deletes from the server as well
    3. If its not possible I beleive it will be available on the next release (10.1.2 ?)
    4. If someone know how to solve this issue it will be nice (not a fan of pop3 )
    Thanks 
    Solved!
    Go to Solution.

    hollywoodhenry wrote:
    Hello,
    Has there been a solotion to this?? 
    My blackberry 9900 would allow me to delete an email on my phone and it would also be deleted on GMAIL. 
    Now with the new Blackberry OS,  I delete an email on my phone and the only action it does on GMAIL is removing it from the inbox, but it still appears in ALL MAIL, so after weeeks of this, there are litreally hundres of emails still in ALL EMAIL that i thought I had deleted already. 
    It's a matter of tweaking your Gmail settings to have the email go to Gmail Trash instead of All Mail.  The article at this link has the clearest desription I've seen..  This is working for me.
    http://crackberry.com/how-get-gmail-delete-hub-without-archiving

  • Deleting mail from server

    I have set up my ipod touch to receive mail from my pop account - it works well except for 2 things:
    -mail messages are not deleted from the server when i receive them on the touch whereas they are when i get them from the client on my computer. Is there a setting on the touch that causes the server to delete received messages?
    -i can receive my pop mail but i cant send from that account. The workaround that i use is to send from my gmail account. This is OK, but i am not sure of the proper settings to get my pop account working in both directions.
    Thanks.

    Hello, 
    If you navigate to Settings > Mail, Contacts, Calendars > {account name} >Advanced > Delete from server > . Personally I would advise against it on the iPod though incase an email doesn't download properly on the iPod or won't display fully at least you will get it on the desktop mail client.
    Typically you can't send email using your ISPs email servers unless you are sat on their Internet connection, but you can send from any other account (like gmail) and receive.
    mrtotes

  • How to use thunderbird on ipad for 2nd mail account without deleting mail from server

    want to monitor wifes ebay messages as it is my account too. her ebay account on different server than Gmail. want to be able to delete monitored messages from my Ipad 2 but not the server, which consequently deletes her mail before she gets it.

    ''jerdog [[#question-1041140|said]]''
    <blockquote>
    want to monitor wifes ebay messages as it is my account too. her ebay account on different server than Gmail. want to be able to delete monitored messages from my Ipad 2 but not the server, which consequently deletes her mail before she gets it.
    </blockquote>
    Thanks for the hint..

Maybe you are looking for

  • How can I create a wiki with Adobe Muse?

    I need to create a wiki for a competition I am in, and I want it to look nice. I need HTML code to create the wiki, and all the code needs to be hosted on their website. They have a box that we are supposed to place the HTML code in. When I use the c

  • Help needed in solving a problem, thanks. Code Attached..

    Hello All I am facing a problem working with Berkely DB 4.5.20. I am trying to search in the database whether the key is already present or not. It is working fine with Microsoft Visual Studio but when i use the same code with Code::Blocks editor and

  • Fonts grayed out in Illustrator type palette - How do I fix this?

    I had OS 10.9 and Illustrator worked with no problems. I have recently upgraded to OS 10.10 and I now experience grayed out fonts in the Illustrator Type Window which I don't experience in Photoshop. I have CS5.1 for Illustrator. Has anyone experienc

  • IC_BASE in CRM 2007

    Hi gurus, When setting up a runtime framework profile in CRM 2007, what is the correct Work Area Defintion Application to call? In CRM 5.0 which we are upgrading from it was IC_BASE, but this has changed in CRM 2007.  I've tried CRM_UI_FRAME but that

  • Air Port Express not showing up on Airport Utility scan

    I recently reset my password on my Airport extreme base station. After I did this my Airport express, which I use to extend the signal, doesn't work. I probably need to reset it's password, too. But now it doesn't show up on the Airport utility when