Could not send mail through smtp

try
props.put("mail.smtp.host", this.getSmtpHost());
props.put("mail.transport.protocol", "smtp");
props.put("mail.server", this.getSmtpHost());
mailConnection = Session.getInstance(props, null);
mailConnection.setDebug(true);
trans = mailConnection.getTransport();
msg = new MimeMessage(mailConnection);
Date date = new Date();
msg.setSentDate(date); // sets sent date for the message
msg.setFrom(from);
msg.setSubject(this.getSubject());
MimeBodyPart html = new MimeBodyPart();
to = new InternetAddress(this.getToAddress());
msg.setRecipient(Message.RecipientType.TO, to);
text.setContent(messageContent, "text/plain");
text.setDisposition(Part.INLINE);
mp.addBodyPart(text, 0);
msg.setContent(mp);
msg.saveChanges();
trans.sendMessage(msg, msg.getAllRecipients());
catch (Exception ex)
ex.printStackTrace();
this gives the following error message
DEBUG: getProvider() returning javax.mail.Provider[TRANSPORT,smtp,com.sun.mail.smtp.SMTPTransport,Sun Microsystems, Inc]
java.lang.IllegalStateException: Not connected
     at com.sun.mail.smtp.SMTPTransport.checkConnected(SMTPTransport.java:985)
     at com.sun.mail.smtp.SMTPTransport.sendMessage(SMTPTransport.java:286)
     at emailmerge.SendEmail1.sendMail(SendEmail1.java:239)
     at emailmerge.EmFrm.jButSend_actionPerformed(EmFrm.java:1613)
     at emailmerge.EmFrm_jButSend_actionAdapter.actionPerformed(EmFrm.java:2649)
     at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:1453)
     at javax.swing.AbstractButton$ForwardActionEvents.actionPerformed(AbstractButton.java:1507)
     at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:373)
     at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:245)
     at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonListener.java:211)
     at com.apple.mrj.swing.ThemeButtonListener.mouseReleased(ThemeButtonListener.java:111)
     at java.awt.Component.processMouseEvent(Component.java:3711)
     at java.awt.Component.processEvent(Component.java:3540)
     at java.awt.Container.processEvent(Container.java:1159)
     at java.awt.Component.dispatchEventImpl(Component.java:2589)
     at java.awt.Container.dispatchEventImpl(Container.java:1208)
     at java.awt.Component.dispatchEvent(Component.java:2493)
     at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:2446)
     at java.awt.LightweightDispatcher.processMouseEvent(Container.java:2211)
     at java.awt.LightweightDispatcher.dispatchEvent(Container.java:2120)
     at java.awt.Container.dispatchEventImpl(Container.java:1195)
     at java.awt.Window.dispatchEventImpl(Window.java:966)
     at java.awt.Component.dispatchEvent(Component.java:2493)
     at java.awt.EventQueue.dispatchEvent(EventQueue.java:334)
     at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:126)
     at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:93)
     at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:88)
     at java.awt.EventDispatchThread.run(EventDispatchThread.java:80)
can any one suggest the remedy please
Regards,
AS

transport.send(msg)
throws the similar exception and authentication on the smtp is not required for my case
As such i get connection to smtp. The exception is thrown only when i try to send the message
Regards,
AS

Similar Messages

  • Database mail is not sending mail through SMTP TLS

    Hello,
    I have strange issue with SQL 2012 and Database mail. For some reason server refusing to send email over SMTP TLS. The only error reported to log is below which is completely  useless (shame on you Microsoft for that).
    I verified that there 
    1. No networking issues between server and SMTP relay host (Installed Windows Mail and sent mail through it)
    2.  That account and password is right (verification same as above)
    3. That mail engine itself is working (verified through plain SMTP relay through local box itself)
    I made a network capture of the process as well and it showing SQL server making initial TLS connection successfully to SMTP relay box and then never sending any data over established TCP connection and eventually timinig out after 60s with no data being
    sent).
    Any ideas?
    Date 1/4/2015 2:03:33 AM
    Log Database Mail (Database Mail Log)
    Log ID 268
    Process ID 223804
    Mail Item ID 125
    Last Modified 1/4/2015 2:03:33 AM
    Last Modified By sa
    Message
    The mail could not be sent to the recipients because of the mail server failure. (Sending Mail using Account 2 (2015-01-04T02:03:33). Exception Message: Cannot send mails to mail server. (Failure sending mail.).

    I looked at both locations mentioned and there is nothing there to tell exactly what is the problem. Again I see on network capture that connection IS established, just no data is being sent. 
    Relay is done through AWS relay server so there is not an issue on their side. Again I tested this scenario via Windows Mail client installed directly on SQL server, so any issues on the other side (like connectivity, timeouts, AV interferences are ruled
    out since Windows Mail works).
    Email error log supposed to have details about failure in last brackets, the one which in my case contains fuzzy "Failure to send mail". It supposed to say "unable to establish connection", "timeout expired" etc if there were
    any issues on the other side. I have found a lot of reports of those issues on this forum where issue is explicitly stated in error message. In my case there is ZERO information about the issue. Mark Russinovich has excellent presentations where he talks about
    useless error messages and this is certainly one of them.
    Failure sending mail.

  • Error while sending mail through SMTP

    Hi,
      We are getting the following error while trying to send mail through SMTP.
    '554 ERROR_MESSAGE_STATE: SMTP_NO_HANDLER( host:1-,subrc:0001)'
    Please advice,
    Regards,
    Sam

    Hi All,
      Configured SMTP as per the note 455140,i can able to send mails from SAP to the out side world,
    mails in SAP.When i tried the test to check whether the SAP system is correctly set up to receive e-mails as per the note 607108, iam getting a connection closed message as below.                                                                           
    afgdev:pgdadm> telnet afgdev 2500                                          
    Trying...                                                                  
    Connected to afgdev.                                                       
    Escape character is '^]'.                                                  
    220 afgdev.abc.ae SAP 6.40(52) ESMTP service ready                   
    helo afgdev                                                                
    250 afgdev.abc.ae                                                    
    mail from:<[email protected]>                                      
    250 Ok                                                                     
    rcpt to:<[email protected]>                                 
    250 Ok                                                                     
    data                                                                       
    354 Enter mail, end with "."                                               
    Hello,This is a test.                                                      
    Connection closed.                                                         
    afgdev:pgdadm> 
    rgds
    Sam

  • Could not send mail using outlook when tethered (m...

    I have had a problem for a long time where I could not send email from my laptop when connected to the internet via a hotspot on my 3 mobile phone.
    After a long conversation with three where we determined that if I used three's SMTP server settings I could send email no problem, but once I was back on wifi i had to change my settings back to the BT settings (mail.btinternet.com), I decided to try and tackle BT support to get a resolution to the issue.
    I knew this would be challenge and that I would end up speaking to someone who could speak english but actually didn't really understand it, and Bt didn't disappoint!!
    I had a long online chat where it was explained to me that if I was connected via my 3g/4g connection I would have to use my providers SMTP because that is just the way it is. O.k. what did I expect!!
    Anyway I am just posting here so if anyone has the same problem I may be able to help you as I have now managed to get this up and running. How?? I hear you ask.
    In my case I used the mail checker on BT to see who's mail service I was with and it varified I was still with BT yahoo rather than BT Mail.
    I decided to try the yahoo setting for the SMTP server rather than the stock mail.btinternet.com and I am now up and running.
    My SMTP Setting is now -  smtp.mail.yahoo.co.uk (port 465 with SSL)
    Hope this helps someone else as I just could not find an answer by googling the issue.

    There is absolutely no reason why it shouldn't work using mail.btinternet.com port 465 with SSL. Works fine for me, albeit on O2 rather than Three, but the principle is the same.

  • Sending Mail through SMTP server

    Hi
    I am trying to sent the mails through smtp server but but my smtp server is not reponding, I tried to delete the account & recreated the accounts & the smtp server but unable to do that, but creating the same mail account & same smtp server works in different laptop. can any one guide me how to correct the problem & repair it.
    Thanks in advance for the support.

    There are a couple of things you might check:
    make sure that you have the server name entered correctly (for example, stmp.gmail.com)
    make sure that if you have to override the default port that you have
    make sure that if SSL is required to connect that you've this option ticked, and
    make sure that if you need to provide a user name and password to access the server that you have.
    Other than that, that's about all that I can think of.
    Clinton

  • Gmail Could not Send Mail

    Hi,
    I've wrote a code to send a mail to recepient from my gmail account.
    My Code is as below:
    import java.io.*;
    import java.security.Security;
    import java.net.*;
    import java.sql.*;
    import java.util.Properties;
    import javax.mail.*;
    import javax.mail.internet.*;
    import javax.servlet.*;
    import javax.servlet.http.*;
    import javax.activation.*;
    public void sendMail(String mailTo, String text)
          String host = "smtp.gmail.com";
          String port = "465";
          String ssl_factory = "javax.net.ssl.SSLSocketFactory";
         final String from = "[email protected]";
          String to = mailTo;
          String user_name = "my_id";
         final String pass = "mypass";
          Security.addProvider(new com.sun.net.ssl.internal.ssl.Provider());
          Properties prop = new Properties();
          prop.put("mail.smtp.host", host);
          prop.put("mail.smtp.auth", "true");
          prop.put("mail.debug", "true");
          prop.put("mail.smtp.port", port);
          prop.put("mail.smtp.socketFactory.port", port);
          prop.put("mail.smtp.socketFactory.class", ssl_factory);
          prop.put("mail.smtp.socketFactory.fallback", "true");
          prop.put("mail.smtp.user",user_name);
          Session ses = Session.getDefaultInstance(prop,
                 new javax.mail.Authenticator(){
             protected javax.mail.PasswordAuthentication getPasswordAuthentication(){
                return new javax.mail.PasswordAuthentication(from,pass);
          ses.setDebug(true);
          MimeMessage msg = new MimeMessage(ses);
          try
             msg.setFrom(new InternetAddress(from));
             msg.setRecipient(Message.RecipientType.TO, new InternetAddress(to));
             msg.setSubject("Password has been set");
             msg.setText("Your new password has been set to: "+text);
             Transport.send(msg);
          catch(Exception ex2)
                ex2.printStackTrace();
       }I Call this method in my Servlet to send reset password to appropriate
    person. Now problem is it is showing error message as below:
    (javax.mail.MessagingException)javax.mail.MessagingException:
    Could not connect to SMTP host: smtp.gmail.com, port:465;
    nested exception is:
    java.net.ConnectionException: Connection timed out: connect
    I've gone thru JavaMail API FAQ, but couldn't find the solution.
    Please help me.
    Thanks.

    The key information is this:
    java.net.ConnectionException: Connection timed out: connectThe JavaMail FAQ has tips for debugging connection problems, start there.
    Possibly someone has changed your firewall configuration to
    prevent such connections.

  • Could not send mails from iPad nor from iMac

    Hello,
    very strange. I use Maverick and iCloud. With Mail on my iPad (latest update installed) and on my iMac I cannot send any mail. I receive mails and using iCloud in Safari on my iMac works fine and I also see the sent mails on my iPad and on my iMac.
    Any idea?
    Michael

    Just some more information.
    If I check the connection Mail says that the IMAP connection to iCloud is okay and working. But no mail leaves Mail, they stay in the outbox.
    I got my to be send mail back on the screen and a window with the message, that there is a time overrun for server „p04-smtp.mail.me.com“ and I should try another server (have e.g. GMX) or try later. Later and e.g. GMX doesn't work either.
    Any help is really appreciated.
    Thanks in advance.

  • Sending Mail through POP Mail

    Hello, I am using POP Mail at home DSL with both Ethernet and Airport without problem in sending and receiving mail. However, when I took my iBook on a trip, and connected it to someone's DSL, either with Ethernet or Airport, I could only receive mail automatically, but could not send mail out unless I used my ISP website to send the mail. However, a few days ago, I pluged my iBook up to a hotel's ADSL, I could both receive and send POP Mail. Why is that?
    Thanks.
    Robert

    Hello Robert.
    It all depends on the policy of whoever is providing you with Internet access at each location. Note that when you’re on a trip and connect through someone’s else network, the ISP at that location is usually not the same as the ISP when you’re at home.
    Many ISPs block port 25 for all traffic outside their own network in an attempt to fight spam. Something that usually works if you’re trying to use an outgoing (SMTP) server different from the one provided by whoever is the ISP at a particular location is changing the outgoing server port to 587 instead of 25 in Preferences > Accounts > Account Information > Outgoing Mail Server > Server Settings, but the outgoing server in question must listen to that port for this change to work.
    Moreover, some ISPs block all ports for outgoing mail, not just port 25, making it impossible to send using an SMTP server not owned by them.

  • Sending Mail through Outlook using PL/SQL

    I have installed Oracle 9i (9.2.0.1) on Windows Xp with SP 2 platform. My MS Outlook has been configured.
    How could i send mail through Microsoft outlook by using PL/SQL Program.

    How could i send mail through Microsoft outlook by using PL/SQL Program.Nonsensical question. MS Outlook is a mail client. A PL/SQL program is also a mail client.
    Both these need to talk to a mail server. It does not make sense for one mail client to "+talk+" to another client for passing it e-mails that need to be send.
    The mail client talks to a mail server using the SMTP ( Simple Mail Transfer Protocol ). There are also other protocols such as IMAP (open standard) and MAPI (Microsoft proprietary).
    Oracle's PL/SQL environment by default supports SMTP via the UTL_SMTP, and UTL_MAIL packages - these provide the PL/SQL developer with an interface to use to send e-mails.
    MS Outlook (client) does not feature anywhere in this regard, whereas MS Exchange as a mail server will (assuming it is being used on your network).

  • Hi, i am having trouble with my mac mail account, i cannot send or receive any emails because of the server connection problems. Message says it could not be connected to SMTP server. Thanks in advance for your help.

    Hi, i am having trouble with my mac mail account, i cannot send or receive any emails because of the server connection problems. Message says it could not be connected to SMTP server. Thanks in advance for your help.

    Hello Sue,
    I have an iPad 3, iPad Mini and iPhone 5S and they are all sluggish on capitalisation using shift keys. I hope that Apple will solve the problem because it is driving me crazy.
    I find using a Microsoft Surface and Windows 8 phone, which I also have, work as well as all the ios devices before the ios 7 upgrade.
    It has something to do with the length of time that you need to hold the shift key down. The shift key needs to be held longer than the letter key for the capitalisation to work. For some reason, this is a major change in the way we have learnt to touch type on computers. I am having to relearn how to type!
    Michael

  • I am not able to send mails through Yahoo APP.It gives me an error msg :"the sender address has ben rejected by the server ".I tried adding username and password in the SMTP server settings,But those optiopns are greyed out.

    I am not able to send mails through Yahoo APP. It gives me an error msg :"the sender address has ben rejected by the server ".
    I tried adding username and password in the SMTP server settings,But those optiopns are greyed out.
    So, i am not able to enter anything in fields under SMTP server settings

    You probably have changing settings disabled in Restrictions.

  • Workflow : Could not send e-mail [10014 : email ...

    hi,
    i am trying to send email notification via workflow, but i am not able to do so. anyone can help to troubleshoot this?
    below are the steps i have carried out for email configuration:
    1. i have added the mail server on mds.ini, MDS is restarted after every changes.
    2. requester and approval has correct email setup at console.
    3. a notification is added in workflow.
    4. telnet ping to mail server with port 25 is fine.
    when i check the log, i have the error :
    "Could not send e-mail [10013 : email : Notify] [Mail server:xxxxxxxxx] [From address:xxxxxxxx] [To address:xxxxxxx
    i know the guidelines and steps for configurations, but apparently it does not workout, so any troubleshoot guideline will be more appreciated.
    Thanks!
    Shanti

    Hi Shanti,
    I am sure you must have checked all this but then again would you please check following things and let us know ?
    1) Please check the SMTP Server Name in your Outlook Express if you are using Outlook
    2) Please log into MDS file and go under that particular Repositoy and check what details you have given for Mail Server
    3) Please give SMTP address in mail server line
    4) Log into Console and check if you have alligned Users and Roles to each other correctly or not.
    5) log into Data Manager and open the workflow and check the properties of Mail notification stencil and check if correct proertise are set ot not.
    Once you have made the changes at server level please restart the server again and then please let us know if this problem exist or not, may be we can more troubleshoot it further.
    Thanks and Regards
    Praful.

  • LDAP - Could not send e-mail

    Hi guru
    We used SAP MDM 5.5 SP 6 (64.92)
    In workflow we use e-mail notification, when SAP MDM Server work without LDAP e-mail is sending.
    When we load SAP MDM Server with LDAP, every time when we send e-mail we get error "Could not send e-mail "
    Sender and Receiver Users and their e-mail adress is exist in LDAP and right.
    Moreover, we test sending e-mail from Server(where installed SAP MDM) through telnet for the same users and same e-mail adress(which precent in LDAP) - all work OK.
    Question:
    How we should configure SAP MDM Server for e-mail notification work correctly when it work through LDAP?
    Regards
    Kanstantsin Chernichenka

    Hi Vinay M.S
    Thank you for your answer, but
    Really, in our case mail server attribute was named as "mail" and it exist in mds.ini (but that is not standart name for all ADs)
    My another question: Why e-mail notification doesn't work from workflow in LDAP for all users?
    Additiona information:
    We have ~30000 users in AD but in MDM we used only ~500 from it.
    For test we created 3 simple workflows with e-mail notification block:
    1.Launcher set as user which name starting from symbol "B"
    2.Launcher set as user which name starting from symbol "P"
    3.Launcher set as "Launcher"
    We set as receiver the same user for all workflows.
    In 1 case e-mail notification is OK
    In 2 case e-mail notification isn't work and we got error "Could not send e-mail" in workflow report. but username and sender receiver e-mail is right
    In 3 case  e-mail notification from user which we started workflow  is OK (and for user which name starting from symbol "P")
    Any ideas?
    Regards
    Kanstantsin
    Edited by: Kanstantsin Chernichenka on Oct 2, 2009 1:35 AM

  • TS3276 can receive mail, can not send, set up smtp(offline)?

    I feel like a jerk, I know it is probably a simple change of wording in advanced setting or something I'm not doing correctly but I can not send mail using aol server. I use Safari only and have 2 accounts plus icloud, I have my Macbook Pro about 10 months and have had several mail issues but I worked them out.

    Hello:
    I use AOL's mail as well.
    Open mail.  Go to preferences and highlight your account in the sidebar.  Click on accounts>account information.  The out going mail server should show smtp.aol.com:your account name.  If that shows "offline," click on the drop down menu  "edit smtp server list."  The server name should be smtp.aol.com in use by your account.  Click on advanced.  You should use the default ports (25,465,587).  I authenticate using a password and my password is prefilled.  On rare occasions I have had a "gremlin" erase the password in that password box.  I have no clue how that happened, but the AOL server would not handle outgoing mail - showed offline.  Sometimes it took me quite awhile (restarts, etc) to get things going again.
    Barry

  • I have an iphone 4s. able to receive all the incoming mails but not able to send mails through this iphone 4s. please help.

    I have an iphone 4s. able to receive all the incoming mails but not able to send mails through this iphone 4s. please help.

    delete and reinstall the email account.

Maybe you are looking for

  • Why am I having lines/borders appearing around my placed Illustrator images in my Indesign Document?

    After I save my InDesign Document and close it... When I open it back up again. There are borders around all of my Illustrator placed images. I can't seem to find out what is causing them or how to get rid of them. When I am working on the file with

  • ITunes 7 and Games

    I just upgraded to iTunes 7 and purchased a game for my ipod, but when I went to put it on the ipod it was impossible - it is just sitting in my library now. Anyone have similar complaints? I have no idea how to get it on there. The ipod has been upg

  • Mail Server auto resending emails

    We have a mail server running 10.8.5. We have run into the following issue, if someone sends out a mass email (multiple recipients or a group)... It starts to auto-resend that message. Every once in a while it will have a pattern of resending every 7

  • Error in Sentiment analysis using Salience engine

    I am using QuickStart install of Endeca and then installed Oracle Endeca Text Enrichment Installer 5.0 (Lexalytics Salience). When I run the graph using the text enrichment, it gives a ERROR message saying "Salience License doesn't support sentiment

  • Adobe Photoshop CS6 Beta Trial Version stopped working.

    I have tried uninstalling the program, I even re installed my windows. And it is a trial version and not cracked. Is there anyone that can help me fix this problem?