Mail doesn't send - javax.mail.MessagingException: 250

Hello all,
I'm new to JavaMail. I actually started with it last night. I've successfully sent a number of messages, but I randomly get a strange exception for no apparent reason.
If I run the exact same code several times, it will produce this error about every 5 or 6 times:
javax.mail.MessagingException: 250 Requested mail action okay, completed
Does anyone know what might be going on? Thanks in advance for any help you might can give.
Here is the heart of my code:
// Get system properties
Properties props = System.getProperties();
// Setup mail server
props.put("mail.smtp.host", host1);
// Get session
Session session = Session.getDefaultInstance(props, null);
          session.setDebug(true);
// Define message
MimeMessage message = new MimeMessage(session);
// Set the from address
message.setFrom(new InternetAddress(fromAddress));
// Set the to address
message.addRecipient(Message.RecipientType.TO, new InternetAddress(toAddress));
// Set the subject
message.setSubject(subject);
// Set the content
message.setContent(content, "text/html");
// Send message
Transport.send(message);
Below is the debugger output: (certain values have been removed for anonymity's sake)
DEBUG: getProvider() returning javax.mail.Provider[TRANSPORT,smtp,com.sun.mail.smtp.SMTPTransport,Sun Microsystems, Inc]
DEBUG SMTP: useEhlo true, useAuth false
DEBUG: SMTPTransport trying to connect to host "xx.xx.xx.xx", port 25
DEBUG SMTP RCVD: 220 domain.company.com ESMTP MailEnable Service, Version: 1.704-- ready at 01/14/04 14:07:27
DEBUG: SMTPTransport connected to host "xx.xx.xx.xx", port: 25
DEBUG SMTP SENT: EHLO licensing
DEBUG SMTP RCVD: 502
DEBUG SMTP SENT: HELO licensing
DEBUG SMTP RCVD: 250-AUTH LOGIN
250-SIZE 5120000
250-HELP
250 AUTH=LOGIN
DEBUG SMTP: use8bit false
DEBUG SMTP SENT: MAIL FROM:<[email protected]>
DEBUG SMTP RCVD: 250 Requested mail action okay, completed
DEBUG SMTP SENT: RCPT TO:<[email protected]>
DEBUG SMTP RCVD: 250 Requested mail action okay, completed
Verified Addresses
[email protected]
DEBUG SMTP SENT: DATA
DEBUG SMTP RCVD: 250 Requested mail action okay, completed
DEBUG SMTP SENT: QUIT

But I am getting that code thrown as a MessageException; the message never goes through. If you look at the debugging output compared to a message that went through, the DATA transmission commands are screwed up.
Thanks for your input, though. I think I've gotten around this by trying to resend the message. It looks like that when I get this exception the message is never sent. I have a catch that detects this exception and tries to resend up to 3 times.
Thanks,
floosh

Similar Messages

  • Mail doesn't send e-mail. Before yesterday everything was ok, but now it says that a copy of the message has been sent to "Sending messages" because the contents of the message cannot be send to server. What to do? IMAP should be ok.

    Mail doesn't send e-mail. Before yesterday everything was ok, but now it says that a copy of the message has been added to "sending messages and the content of the message cannot be sent to the server". All the data in IMAP is ok. What to do?

    thanks for replying!
    When sending from one mac email account to another email account on the mac it seems to send fine, and it moves to the sent items, but nothing appears in the mac inbox.
    When sending from a mac account to the pc, it seems to send fine, and it moves to the sent items, but nothing appear in the PC inbox.
    When sending a massage from the PC to my mac email, it send fine from the PC and arrives in the inbox on the mac.
    mac to mac - seems to send but dosent arrive
    mac to pc - seems to send but doesnt arrive
    pc to mac - seems to send and arrives.
    As i said it was all working fine yesterday and for four years previous to that, but now it has just stopped.
    I hope you can help.

  • AOL mail doesn't send .doc-files with Firefox

    When using Firefox AOL Mail doesn't send .doc-files. Instead a corrupted file with a different size is sent. Any other file type works aswell as sending .doc-files with other browsers works...

    I'm getting a similar problem. Snow Leopard Mail for me seems to be choking on large attachments - sending them, forwarding them, or even moving them from one IMAP folder to another.
    My mails are getting through, but it takes a long time and they are dragging the whole system to a crawl in the process.

  • Mail doesn't send to certain e-mail addresses, receiving seems ok

    I am using the latest version of the Apple Mail application under Leopard (with all updates downloaded). About a month ago I e-mailed a friend from my home account and unusually didn’t get a reply. I then e-mailed again a few weeks after, again no reply. After a phone conversation found out she didn’t receive either of my mails. This prompted many test e-mails, the outcome of which was the following:
    1 - Was able to receive my friend’s e-mails, but if I replied using Apple mail (hitting the reply button), my reply never got back to her.
    2 - Was able to send to and receive my friend’s e-mails using MS outlook from my place of work using a PC and my work e-mail account. No problems.
    3 - Was able to send and receive to my work account from my home account using Apple Mail, no problems.
    4 - Was able to send and receive my friend e-mails from my home account, using web mail rather than using Apple Mail.
    5 - Could no longer e-mail my wife using the Apple Mail (and she could not e-mail me), we both use the same ISP. However using web mail rather than Apple Mail we could still send and receive e-mails from each other.
    6 - Phoned my ISP, my account seems to be ok, which was also confirmed by using webmail as described in the previous two points.
    7 - Other than the regular Apple updates the Mail app is the same client I have been using since I got my new Mac last October. I didn’t appear to have any problems until about a month ago and have made no changes to settings etc.
    8 - When I do attempt to send e-mails to my wife or friend, I get the usual whooshing sound and a progress bar to show that the mail has been sent. The outbox is empty and the mail appears in the sent box, but never arrives to its destination. No error messages or e-mail bounce backs, nothing.
    9 - Downloaded and installed Thunderbird, all the problems seem to go away – I can now send and receive e-mails from both my wife and friend.
    It’s a bit weird that Apple Mail seems to have taken an aversion to sending mail to some particular e-mail addresses. Unless someone can explain what is going on here, I think that this is a serious problem. As I’ve mentioned, there is no hint that Apple Mail is not sending e-mail, as far as I was concerned e-mails were leaving my Mac. Has anyone experienced something similar? Is there an easy fix?

    I just did a quick test in InDesign CC and my one worked. Maybe you should delete the button and redo it.
    By the way on a slightly different matter, do you know that to enable users to complete the form and store it on their computer using Acrobat Reader, you need to enable the form as follows:
    Open the form in Acrobat XI  and then:
    File > Save As Other > Reader Extended PDF > Enable More Tools (includes for fill-in & save). . . Your users will be able to fill in the form and save it (assuming they have the later versions of Acrobat Reader).
    Make sure you keep a copy of your original PDF with a different file name as once you've created a Reader Enabled PDF Form you can't change it.

  • Mail doesn't save sent mail on one of my email accounts.....

    Mail doesn't save sent mail on one of my email accounts. I have several accounts, but on one of them it just doesn't save any mail I send. Is there a hidden setting I've missed somewhere? I did delete the account and then reset it, but it took out all of my emails to that address so I'm loathe to do that again!

    I'm lucky enough to have two Macs running OS X 10.9 next to each other, both using the same network, and sharing a common Exchange mail server. My corporate machine (an first gen' Aluminium iMac) has both Outlook and Mail installed. My personal machine (a 13" MacBook Air) has only Mail installed.
    Neither install of Mail is guarenteed to write sent messages to the Exchange Sent folder (it might happen, it might not). Both write perfectly to other common mail servers (e.g. GMail). Outlook writes perfectly to the Exchange server, but generally functions less effectively as a mail client than Apple Mail.
    The failure to write to the Exchange server only happened after the upgrade.
    It's quite frustrating.

  • I am set up mac mini and when I test the mail server by sending a mail from administrator to administrator I get the error message 'Diagnostic-Code: X-Postfix; connect to 127.0.0.1[127.0.0.1]:10024: Connection    refused'. Can any one suggest a solution

    I set up mac mini and when I test the mail server by sending a mail from administrator to administrator I get the error message 'Diagnostic-Code: X-Postfix; connect to 127.0.0.1[127.0.0.1]:10024: Connection    refused'. Can any one suggest a solution

    Thanks. Where could I possibly look for a firewall rule. I knowingly did not creat any. My system has internet coming to a Modem which then is connected to a wireless router. I have computers connecting to the router through cable as well as wireless. One of these computers has been our  mailserver using Mercury and Pegasus and that computer has a static IP address. The Mac Mini also has been assigned a different srtatic IP address. I have only set up user account, none of them an email account as I initially expect them to receive only internal mails. Is it necessary that I must set up an email id for each user while setting up the user account. My server id is server.local. So would the email id for local users be [email protected]?

  • TS2755 since updating to ios7 I can receive e-mails, but cannot send e-mails from my phone

    since updating to ios7 I can receive e-mails but cannot send e-mails from my phone

    Hi there ritawilk,
    You may find the troubleshooting steps in the article below helpful.
    iOS: Troubleshooting Mail
    http://support.apple.com/kb/ts3899
    -Griff W. 

  • Mail doesn't send mails with attachments 1Mb

    Hi,
    I'm using Mail with a ManagedExchange account. Before Snow Leopard I was using Entourage 2008.
    Everything seems to work fine. Except sending of larger files fails.
    Every time I send a mail which is approx. <1Mb Mail starts transmitting data (see it via Little Snitch 2.2b) and stops after a while doing nothing anymore. The mail stays in the outbox, and the moving circle which indicates that a folder is being synchronized appears endless. No other mails are going out then. After a while I get a message that my email couldn't be sent via my mail server. And the connection failed. And I can choose another mail server if I would have any. Entourage doesn't have that problems. So the connection seems to be fine. Small attachments are no problem.
    What's the problem?
    Regards,
    OberMufti

    I'm getting a similar problem. Snow Leopard Mail for me seems to be choking on large attachments - sending them, forwarding them, or even moving them from one IMAP folder to another.
    My mails are getting through, but it takes a long time and they are dragging the whole system to a crawl in the process.

  • Mac Mail doesn't send with parentheses in signature...

    I met with someone at the Apple Genius Bar today to try and troubleshoot a problem I've been having with sending mail via Comcast.
    In short we were able to find a workaround  I decided to post what we concluded in the case that someone else can clarify or benefit from what we learned... which is that any parentheses in the e-mail signature prevents the e-mail from being sent.
    We attempted, almost 40 e-mails, of various configurations of the signature which contained a phone number.  regardless of its position, formatting including newline characters, when the phone number didn't have the parentheses the mail sent.
    And all these tests occurred with a fresh new e-mail account which by default set perfectly every time. Attachments, pasted and graphics, made no difference. All the previous mailboxes were also removed and plans were trashed so we were starting from a clean start.
    This is with Mail version 4.5 and OS 10.6.8 on an iMac... I can't go to mail 5 I need to run Rosetta.

    I'm getting a similar problem. Snow Leopard Mail for me seems to be choking on large attachments - sending them, forwarding them, or even moving them from one IMAP folder to another.
    My mails are getting through, but it takes a long time and they are dragging the whole system to a crawl in the process.

  • Mail doesn't send emails

    I have two accounts. Mail suddenly stops sending emails though i can receive emails from that account. I checked the email server and it is absolutely working fine. It throws an error and asks me for my password again and again. Whats weird is that this happens at random intervals. Can someone help me out.

    Try deleting the password in Applications/Utilities/Keychain Access.
    Try running Keychain First Aid.
    Keychain Reset
    Keychain Issues - Resolve  see post by Kappy
    Troubleshooting sending and receiving email messages
    Troubleshooting sending email messages

  • Mail will not send out mail... but I can recieve?

    Hey guys, well yesterday my mac mail would not send out any mail, and still won't this morning. I am using AOL mail through the Mac mail program. I have been using it forever and never had a problem.
    It is telling me "cannot send message using the server smtp.aol.com:(myusername). Sending the message content to the server failed. Select a different outgoing mail server from the list below or click try later."
    I have 3 email accounts I use through mac mail and all 3 are not working. To send mail I have to sign into aol and it stinks. Can anyone help me to figure out why this just quit working?
    Thanks

    ISPs often change things on a whim; they aren't known for being the most communicative bunch of people. But if you're sure you have your Mail settings entered correctly for your AOL account:
    Incoming Mail Server: imap.aol.com or imap.aim.com (if using IMAP)
    Outgoing Mail Server: smtp.aol.com
    In the Account name: box, type your AOL® or AIM® screen name.
    In the Password: box, type your AOL® or AIM® password.
    and it still doesn't work, I'd call your ISP and see what's going on; they can determine whether or not you're able to get outside their network.
    Mulder

  • Iphone 3G, Exchange mail - can't send new mail only works by reply

    Before upgrading from 2.0 to 2.0.2 all worked like a charm with Exchange mail. Now I am not able to send new mail from iphone using Exchange account. When I try to do so, a send bar appears shortly, but no message is sent. When trying to forward a note from Notes application using exchange account, also applications closes down automatically.
    The only viable option to send mail via Exchange is by replying to someone's message.
    How to deal with this?
    I have tried to delete all accounts on iphone and re-establishe them. Doesn't work.

    Discovered, that it is a problem connected to Contacts. If you are using Contacts or typing a new email address, New mail won't go.
    If you however browse Exchange address book and select a person to send email to, that will work.
    Apple what happenedin 2.0.2?

  • Mail created with "Send to Mail Recipient" disappear and are not sent

    I have a small setup with a SBS 2011 server (Exchange 2010) 10 users with Windows 8.1 and Outlook 2013.
    One user is trying to send mails with attachments to his college´s
     but they are never send, are not shown in sent items and can not be found on the server.
    The user right click on a PDF file and press "Send to Mail Recipient" Outlook opens his mail is entered into the receiver (internal receiver) and press send. The mail do not show up and as mentioned even in sent items.
      I then try to do the same but send through the address book in Outlook / Exchange and these messages appears as they should.
    One week later, the disappeared mails suddenly appears in the college’s mailboxes and it turns out there are some mails to external addresses as well, which were not sent until a week. All messages are now in sent mail but they have not
    appeared anywhere else before.
    I did some tests with the "send to" function which also had the mails disappearing - those mails has not turned up until now. (a week ago)
    Now the user (AND all colleagues)  are very nervous that something is wrong with their system and the mail does not arrive.
    It is only 1 user this has affected but he is responsible for the majority of sales in this company and they are very afraid that they are not responding correctly to large customers.
    Is there anyone who can help with debugging in such a case?
    I have tried repairing Outlook, started in safe mode, checked the mail server for hanging mails but nothing shows any errors.
    Thanks in advance.
    Michael Grøn
    Michael Gron

    Hi,
    Have the user logon OWA and send the attachment, will this issue persist?
    Please also confirm if the issue exists when inserting an attachment when composing a new email isntead of using the "Send to Mail Recipient" function.
    Since only one user has been affected, use MFCMAPI to find if the message is stuck in the user's mailbox:
    https://mfcmapi.codeplex.com/releases/view/118446
    Please Note: Since the web site is not hosted by Microsoft, the link may change without notice. Microsoft does not guarantee the accuracy of this information.
    Thanks,
    Melon Chen
    Forum Support
    Come back and mark the replies as answers if they help and unmark them if they provide no help.
    If you have any feedback on our support, please click
    here

  • Mail does not send out mail / builds loads of drafts of the same message

    The problem described above I had for quite a while. Mail I send disappeared and I could find them back in the outbox under prefs/mail/outbox the outbox in mail.app was empty. Having to check your send items every time you have sen out an email is not an option :P
    This made me follow a tip I found here to delete mail folder and the .plist files restart my MBP and reopen mail and let everything be restored from me.com
    Unfortunately after a week problems are reoccurring.

    No Mobile me works fine. And with fine I mean the problems with Mail.app are related to mobile me or leopard.
    With leopard; mail got to do and task witch are only half implemented, adding a note to a task can only be done in calender.
    Mobile me; sins the change of .mac to me I have been having issues
    Unfortunately leopart and then especially mail and mobile me are both buggy.
    Hope this will be addressed and throughout tested with a next update.

  • Mail won't send aol mail from ipad since updating to version 5

    I use aol and since I updated to version 5 I can't send aol mail but I can receive it.  Has anyone had that problem and found a solution?

    I'm using AIM mail on my iPad 2 with no problems.  I can send and receive.
    I assume it was working fine before the upgrade?  Did you double-check the settings?

Maybe you are looking for