URGENT::Status returned by Transport.send() and problem with mail.smtp.host

Hello,
I am writing a code to send an email using JavaMail. I have added mail.jar and activation.jar in the classpath. Also I would like to mention that I am using Weblogic6.1 SP4.
A bunch of questions:
1. After calling Transport.send(), how do i know if the mail was sent successfully or not ?? Is there anyway I can handle that?
2. I am using props.put(mail.smtp.host, <some-value>). What should be this <some-value> ?? Where can I get this value from??
And is this value sufficient for the code to know that which server we are using for it? Do we need to give any URL/Port etc? How does this work?
3. Is there anything else other than smtp host, username and password to be added to props?? Do we need to create a properties file??
4. After doing these things, do I need to create a mail session in the Weblogic server also or is it a different method?
Please help me in resolving these issues.
Thanks

Thanks for your kind answers, Dr. Clap..!!
However, I will again like to ask u this:
1. As i said that I installed Weblogic 6.1 in my local machine, can I use it as the mail server? As the server is local to my machine, i know that its only me who is the incharge of it. How do I know what smtp host to use.
2. I am using this code:
public callService(ServiceRequest request) throws Exception {
     EmailRequest req = (EmailRequest) request;
     Session session = null;
     MimeMessage msg = new MimeMessage(session);
     String accNum = req.getAccountNumber();
     String toAddress = req.getToAddress().trim();
     String fromAddress = generalConfig.FROM_EMAIL_ADDRESS;
     String subject = req.getSubject().trim();
     String message = req.getMessage().trim();
     String [] arrToAddress = null;
     String fileName = "./"+accNum+".htm";
     if (toAddress != null) {
arrToAddress = convertToArray(toAddress);
     Properties props = System.getProperties();
     props.put("mail.smtp.host", "MYSERVER"); //STILL NEED TO FIGURE OUT WHAT VALUE TO PUT HERE
session = Session.getDefaultInstance(props);
     setRecipientsTo(msg,arrToAddress);
     msg.setFrom(new InternetAddress(fromAddress));
     msg.setSubject(subject);
     msg.setText(message);
MimeMultipart mp = new MimeMultipart();
MimeBodyPart text = new MimeBodyPart();
     text.setDisposition(Part.INLINE);
     text.setContent(message, "text/html");
     mp.addBodyPart(text);
     MimeBodyPart file_part = new MimeBodyPart();
     File file = new File(fileName);
     FileDataSource fds = new FileDataSource(file);
     DataHandler dh = new DataHandler(fds);
     file_part.setFileName(file.getName());
     file_part.setDisposition(Part.ATTACHMENT);
     file_part.setDescription("Attached file: " + file.getName());
     file_part.setDataHandler(dh);
     mp.addBodyPart(file_part);
     msg.setContent(mp);
Transport.send(msg); //send message
In this code, like I am using Properties class, will this code work fine(as it is) even if I dont make any Properties text file?? or is it mandatory for me to make the properties text file and to add some values to it?
I am sorry, I may sound a bit dumb, but I just need to learn it somehow.
Thanks.
P.S: convertToArray() and setRecipientsTo() are my own defined private methods.

Similar Messages

  • No Access to iCal, iTunes and Problems with Mail

    While Leopard is a very wonderful new OS, I have multiple problems that I cannot resolve. Once installed, I started with the "Blue Screen" problem, and had to delete various extensions that were not from Apple. Once permissions were repaired, I could use Leopard. I have made permission repair on the UNIX level, but still cannot access iCal, Mail will only retrieve some of my mail and I have to force quit Mail, and now that I upgraded to 10.5.2, I cannot access my music files from iTunes. The message states that the files are "Locked".
    Any helpful thoughts will be greatly appreciated

    The best solution we found was to wipe the hard drive, and reload Leopard. You cannot upgrade from Tiger with the earlier version of Leopard without having problems.

  • I have a problem sending mail via smtp. I use a satellite system and the average return time for a ping is 675ms. Is this a problem with mail? If so can I change Mail to accept it. The problem also exists with Lion

    I have a problem sending mail via smtp. I use a satellite system and the average return time for a ping is 675ms. Is this a problem with mail? If so can I change Mail to accept it. The problem also exists with Lion and on both my MacPro and my wife's Imac. I also see my mailboxes randomly disconnecting and reconnecting. Any other ideas of a possible cause?

    I solved it myself, after the "note" which came back from FF/Mozilla just as I finished my message, commenting on what it was that my system had , I wnnt back to check my plug-ins etc. I downloaded the latest Java, BOTH 32bit AND 64 bit versions and latest Firefox.
    Now all is working.
    Thanks,
    B.

  • Help transport .send(message) problem

    I am getting an error at transport.send(message)
    javax.mail.SendFailedException: Sending failed; nested exception is: class javax.mail.AuthenticationFailedException After eleminating all lines the error is at transport.send(msg)
    Please help - tell me what I have been doing wrong
    My code - is java mail using a jsp
    try{
         //Properties props = System.getProperties();
    Properties props = new Properties();
    Store store;
    props.put("mail.smtp.host", "smtp.snet.yahoo.com");
    props.put("mail.smtp.auth", "true");
    Session s = Session.getInstance(props,null);
    MimeMessage message = new MimeMessage(s);
    InternetAddress from = new InternetAddress("[email protected]");
    message.setFrom(from);
    String toAddresses = request.getParameter("to");
    message.addRecipients(Message.RecipientType.TO, toAddresses);
    String ccAddresses = request.getParameter("cc");
    message.setRecipients(Message.RecipientType.CC, ccAddresses);
    String bccAddresses = request.getParameter("bcc");
    message.setRecipients(Message.RecipientType.BCC, bccAddresses);
    String subject = request.getParameter("subject");
    message.setSubject(subject);
    message.setSentDate(new Date());
    String text = request.getParameter("text");
    message.setText(text);
    Transport.send(message); //error is here
    %>

    You are specifying authentication to be used, but you aren't supplying any authentication credentials, hence the AuthenticationFailedException.
    You need to create an Authenticator class. If you just need simple username/password authentication, just create a class to handle this.
    For example:
    public class SimpleAuthenticator extends Authenticator {
      private String username;
      private String password;
      private PasswordAuthentication auth;
      public java.lang.String getPassword() {
        return password;
      public PasswordAuthentication getPasswordAuthentication() {
        if(auth == null) {
          auth = new PasswordAuthentication(username, password);
        return auth;
      public java.lang.String getUsername() {
        return username;
      public void setPassword(java.lang.String password) {
        password = password;
      public void setUsername(java.lang.String username) {
        username = username;
    }Then, when you create the session:
    SimpleAuthenticator auth = new SimpleAuthenticator();
    auth.setUsername("yourusername");
    auth.setPassword("yourpassword");And instead of
    Session s = Session.getInstance(props,null);use
    Session s = Session.getInstance(props,auth);

  • Problem with sending and receiving e-mail through exchange [GMail]

    Hello I have problem with sending and receiving e-mail.
    all is well set, username and password are correct, the server set m.google.com. verification of data is about like stepping into a post and want to check the post office gives me an error message: Can not Get Mail. The connection to the server has failed
    I have this problem on my two iPhone

    http://www.zdnet.com/google-drops-exchange-activesync-support-for-free-email-acc ounts-7000008836/

  • I have a new iPhone 6 plus and all is OK. But the mail shows more than 400 'unread' messages whereas there are none in the mailbox or trash or anywhere else I have looked. I can send and receive with no problem. I'm sure I have no unread messages.

    I have a new iPhone 6 plus and all is OK. But the mail shows more than 400 'unread' messages whereas there are none in the mailbox or trash or anywhere else I have looked. I can send and receive with no problem. I'm sure I have no unread messages.

        jsavage9621,
    It pains me to hear about your experience with the Home Phone Connect.  This device usually works seamlessly and is a great alternative to a landline phone.  It sounds like we've done our fair share of work on your account here.  I'm going to go ahead and send you a Private Message so that we can access your account and review any open tickets for you.  I look forward to speaking with you.
    TrevorC_VZW
    Follow us on Twitter @VZWSupport

  • Having problem with gmail smtp server.  Since going to google 2-step, and entering 16-digit code in gmail account, I can receive mail on my iMac, but cannot send.  What do I do?

    Having problem with gmail smtp outgoing server.  Since going to google 2-step, and entering 16-digit code in gmail account, I can receive mail on my iMac, but cannot send.  I keep getting an error message that Mail "Cannot send message using Gmail (my assigned name) server."  What do I do?

    Confirm you did this: https://support.google.com/mail/answer/1173270?hl=en
    You might also try removing all gmail passwords from your keychain in Keychain Access. Then connect again and enter the password code given by Google.

  • I have a problem with mail.  the spelling and grammer check box before sending the messege is no longer there.  I did everything but cannot get it back.  is ther anyone who knows how to get the box with spelling and grammer checks before sending

    i have a problem with mail.  the spelling and grammer check box before sending the messege is no longer there.  I did everything but cannot get it back.  is ther anyone who knows how to get the box with spelling and grammer checks before sending the mail.
    Also the mail is acting very funny by not getting the rules work in a proper method.  Is ther a software to repair mail.

    i did both of them, but still the while sending the mail the diolog box is not showing up and also the spelling and grammer does not do the spelling check. 
    This problem just started for about 3 to 4 days now.  earlier it was working normally.

  • R/3 to XI manually IDOC sending and problem:

    <u><b>R/3 to XI manually IDOC sending and problem:</b></u>
    I sent IDOC using we19 transaction from R/3 system. After sending it asks me userid and password for XI system. I give necessary UID and PASS. R/3 system says me sucessfully sent.
    I check XI (sxmb_moni) but there is nomessage there.
    <b>Problem 1:</b> I don't want R/3 ask me UID and password for XI access
    <b>Problem 2:</b> I want to see message in XI (sxmb_moni)
    Thanks

    Hi Cemil,
    >>>>After sending it asks me userid and password for XI system. I give necessary UID and PASS. R/3 system says me sucessfully sent.
    check the RFC destination from R3 to XI (SM59)
    you will find the right one from your port (We21)
    you can also check step by step procedures
    for IDOC - XI in my book:
    <a href="/people/michal.krawczyk2/blog/2006/10/11/xi-new-book-mastering-idoc-business-scenarios-with-sap-xi"><b>Mastering IDoc Business Scenarios with SAP XI</b></a>
    Regards,
    michal
    <a href="/people/michal.krawczyk2/blog/2005/06/28/xipi-faq-frequently-asked-questions"><b>XI / PI FAQ - Frequently Asked Questions</b></a>

  • I cannot not send and receive e-mails

    Translated with the help of Google Translate.
    Mail: Version 7.3 (1878.6)
    Two-step verification set
    Since a number of weeks I cannot not send and receive e-mails.
    And I cannot find an answer in the support community.
    I suppose the cause can be found in the two-step verification or in the TLS certificate ... but in this I am a layman.
    The connection wizard explanes:
    iCloud IMAP Failed to log on this iCloud IMAP account. Make sure the username and password are correct
    SMTP Failed to log on this SMTP account. Make sure the username and password are correct.
    I'm 99.999% sure that the username and password are correct. Those missing 0.001% can be found in another problem somewhere else. Who advises me?
    My settings are as follows:
    [Account Information]
    iCloud IMAP
    E-mail: [email address] @ me.com
    Incoming mail server: imap.mail.me.com
    username: [email address] @ me.com
    password: my iCloud account {four digits, a hyphen, five Uppercase, 1 lowercase}
    server name outgoing e-mail: smtp.mail.me.com
    TLS certificate
    [Outgoing mail server / Edit SMTP Server List / account information]
    Server Name: smtp.mail.me.com
    TLS certificate
    [Outgoing mail server / Edit SMTP Server List / advanced]
    custom port: 587
    Use SSL: yes
    Authentication: Password
    username: [email address] @ me.com
    password: that of my iCloud account
    [Advanced]
    IMAP path prefix: left blank
    Port: 993
    Use SSL: yes
    Authentication: Password
    Use IDLE command: checked.
    I hope I get soon an answer.
    iMac (27-inch Mid 2010), OS X Mavericks (10.9.5), Mail

    Troubleshooting Apple Mail
    What does Mail/Window/Connection Doctor Show? If the server is red, select it and look at the Show Details box.
    Troubleshooting sending and receiving email messages
    Troubleshooting sending email messages

  • Problems with Mail, Safari and iTunes after updating to 10.5.6

    Hi all,
    after installing 10.5.6 I have problems with Mail, Safari and iTunes.
    The time to open mails, websides and iTunes store is increasing dramatically since the update. If I open a webside parallel with Safari and Firefox, Safari needs minimum 15 times longer to open the complete side. Mails containing HTML-code also needs a long time to be opened. Tha same Problem with iTunes store. Connecting to the Store costs at least 30 - 40 seconds. And unfortunately for every iTunes store side I open. Its terrible
    Any idea or workaroung to solve that problem?
    Regards
    Michael

    First, run Disk Utility and repair permissions and then restart.
    I installed the 10.5.6 Combo update. Sometimes things get "lost in the translation" when you use Software Update depending on your installation. Perhaps you can download 10.5.6 Combo from the website and install it from your desktop.

  • I am having a problem with mail. In my junk mail folder I have two messages which I drag to trash and empty. Within a few minutes the messages are back in junk mail folder

    I am having a problem with mail.  I am attempting to trash junk mail. Each time I do this and a while later I find the junk mail has not been discarded and is back in junk mil folder.

    Hi tony paine,
    Welcome to the Support Communities!
    The article below may be able to help you with this.
    Click on the link to see more details and screenshots. 
    iCloud: Keeping the Junk folder consistent between iCloud Mail and OS X Mail
    http://support.apple.com/kb/HT4911
    Cheers,
    - Judy

  • I have a problem with Mail on my Macbook Pro. It is configurated with a gmail account, and now I can't access the mail. Is it possible to reboot the account or..? Please help:)

    I have a problem with Mail on my Macbook Pro. It is configurated with a gmail account, and now I can't access the mail. Is it possible to reboot the account or..? Please help:)

    The question mark means the computer cannot find a bootable volumes so can;t do anything, That, combined with annoying sounds, strongly suggests a failed hard drive.
    You can ask a "genius" at an Apple Rtail Store to test it but I'm pretty sure the drive is kaput. I'm hoping you had your data backed up.

  • Since installing mountain lion i have a problem with mail. when i delete a message close  and open mail the message has come back. please help!

    Since installing Mountain Lion i have a problem with Mail. I delete a number of messages from the same person but keep the newest message in my Inbox. I actually delete them from the Trash. The next time i open Mail the deleted messages are back again. Can anybody please help as this is getting annoying. Thanks in Anticipation.

    Problems such as yours are sometimes caused by files that should belong to you but are locked or have wrong permissions. This procedure will check for such files. It makes no changes and therefore will not, in itself, solve your problem.
    First, empty the Trash.
    Triple-click the line below to select it, then copy the selected text to the Clipboard (command-C):
    find ~ $TMPDIR.. \( -flags +sappnd,schg,uappnd,uchg -o ! -user $UID -o ! -perm -600 -o -acl \) 2> /dev/null | wc -l
    Launch the 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.
    Paste into the Terminal window (command-V). The command may take a noticeable amount of time to run. Wait for a new line ending in a dollar sign (“$”) to appear.
    The output of this command, on a line directly below what you entered, will be a number such as "41." Please post it in a reply.

  • Problems with Mail and Safari

    Hi,
    I'm running OS 10.11 and am having some consistent problems with Mail and Safari on my MacPro Dual 2.66. Here they are:
    Sometimes, for no apparent reason, selecting these applications from the dock no longer opens the application (or a new window if already opened), but causes them to be revealed in the finder.
    In Safari, when this problem occurs, another symptom seems to be that new windows will ONLY open in a new tab, even though I have preferences set to open links in a new window. If I click on a bookmark within a folder in the bookmark toolbar, Safari will open ALL the bookmarks in the folder in new tabs!!
    In Mail, when I open my Inbox, clicking on various messages will highlight (in blue) ALL the messages I'm clicking on, instead of simply displaying the highlighted message in the reader.
    The only way to get things back to normal is to reboot my machine, which is getting to be a total drag, especially since this seems to happen fairly often.
    One other thing that may be related- if my screen saver is running, and I move the mouse to go to an active screen, the computer will "freeze." It stays like this indefinitely- I figured out that if I press the button on the machine itself it will go to sleep, and I can wake it up and then everything is fine, but I don't understand what's going on.
    I have tried using Disk Utility and Disk Warrior, and have used OnyX to clean out my system cache and aall sorts of other stuff, but to no avail.
    Is anybody else experiencing any of this? I'm starting to get really frustrated. Thanks for any advice.
    Cheers,
    Andrew

    Scott,
    I had posted earlier that I had Flash payer problems and then QuickTime and PDF preview problems too, on my Intel PowerMac. I could not figure out what the problem was, because fixing permissions and moving plugins did not work. Console indicated that the Quicktime components were not found, with the problem in a webkit pref file somewhere (nil field value). Anyway, I bailed and reinstalled Leopard from a 10.5.0 DVD, and then updated using the combo updater to 10.5.3. Everything worked. Then, after the 'Java for Mac OSX 10.5 Update 1', it all broke again. This time, repairing permissions resulted in:
    User differs on "System/Library/Frameworks/JavaVM.framework/Versions/1.4.2/Home/lib/jvm.cfg", should be 0, user is 95.
    User differs on "System/Library/Frameworks/JavaVM.framework/Versions/1.4.2/Libraries/classlist" , should be 0, user is 95.
    Now it all works again. This is obviously a flaw with the Java update, and also somehow Disk Utility did not find it earlier. Anyway, take a look at reverting the Java update, or manually changing user for those files (I suppose user 0 is root, but maybe it is nobody).
    Obscure....

Maybe you are looking for