Java SMTP Client and Outlook unique behaviour

Hi
I have written a simple Java client to send a mail with an attachment to a mail address. Its a normal Java SMTP client with multi part file attachment.
There is a unique behavior happening which is eating my head for some time now. The issue here is that when i try to send an attachment from my Outlook the message is being delivered to the recipient successfully in recipients inbox. But when i send the same attachment through my standalone Java client its not getting delivered to the recipient(not 100 % sure, spamming maybe).The client is not throwing any exception also so its become very hard as to whats going on as i think the mail is getting delivered but not sure. The recipient email address is on a Linux box so don't know how to access it. please help me on this.
Thanks
Vikeng21

Hi EJP , Below is the code that i have written for the same
import java.io.File;
import java.util.Properties;
import javax.activation.DataHandler;
import javax.activation.DataSource;
import javax.activation.FileDataSource;
import javax.mail.Address;
import javax.mail.BodyPart;
import javax.mail.Message;
import javax.mail.Multipart;
import javax.mail.Part;
import javax.mail.SendFailedException;
import javax.mail.Session;
import javax.mail.Transport;
import javax.mail.internet.InternetAddress;
import javax.mail.internet.MimeBodyPart;
import javax.mail.internet.MimeMessage;
import javax.mail.internet.MimeMultipart;
public class msgshow {
public static void main(String[] args) throws Exception {
     String host = "***hostname***";
     String from = "***fromEmailId***";
     String to = "***toEmailId****";
     String filename = "log.txt";
     try{
          // Get system properties
          Properties props = System.getProperties();
          // Setup mail server
          props.setProperty("mail.smtp.host", host);
          //Doing this for testing as the properties are being set by using default system user properties.If user authentication is required
          boolean authValue = true;
          if(authValue){
               props.setProperty("mail.user", "***username***");
               props.setProperty("mail.password", "***password***");
          props.setProperty("mail.debug", "true");
          // Get session
          javax.mail.Session session = javax.mail.Session.getInstance(props, null);
          // Define message
          Message message = new MimeMessage(session);
          message.setFrom(new InternetAddress(from));
          message.addRecipient(Message.RecipientType.TO,
          new InternetAddress(to));
          message.setSubject("VVVVVVVVSSSSSSSSSS");
          // Create the message part
          BodyPart messageBodyPart = new MimeBodyPart();
          // Fill the message
          messageBodyPart.setText("Here's the file");
          // Create a Multipart
          Multipart multipart = new MimeMultipart();
          // Add part one
          multipart.addBodyPart(messageBodyPart);
          // Part two is attachment
          // Create second body part
          messageBodyPart = new MimeBodyPart();
          // Get the attachment
          DataSource source = new FileDataSource(filename);
          // Set the data handler to the attachment
          messageBodyPart.setDataHandler(new DataHandler(source));
          //before setting the file name we have to set the proper file name
          final File individualFile = new File(filename);
          String fname = individualFile.getName();
          // Set the filename
          messageBodyPart.setFileName(fname);
          messageBodyPart.setDisposition(Part.ATTACHMENT);
          // Add part two
          multipart.addBodyPart(messageBodyPart);
          // Put parts in message
          message.setContent(multipart);
          // Send the message
          Transport.send(message);
          System.out.println("Message is sent");
     }catch(SendFailedException e){
          System.out.println("------------ Send Failed Exception -----------");
          Address adr[] = e.getValidSentAddresses();
          for(int i = 0; i < adr.length;i++){
               System.out.println("------- Valid Sent address" + adr);
          Address adr1[] = e.getValidUnsentAddresses();
          for(int j = 0; j < adr1.length;j++){
               System.out.println("------- Valid Sent address" + adr[j]);
          e.printStackTrace();          
     }catch(Exception ez){
          ez.printStackTrace();

Similar Messages

  • Oracle 10g client and Outlook Address Book

    I have looked everywhere that I can think of, and nobody seems to have an answer to this problem. I support an extensive VB6 application, and one piece of functionality, which has been working without problems using Oracle 8i and 9i client, is now having problems when we use it on a client with 10g client installed.
    The functionality in question is the ability to click a button that opens the user's Outlook Global Address Book, and return the e-mail address of the address selected. When the application is initially opened, the address book opens without problem. Once the user connects to Oracle (from within the application), from that point on, until the application is closed and restarted, clicking the button to open the address book produces the not-so-helpful error message "This application has failed to start because BJABLR32.dll was not found. Re-installing the application may fix this problem." The .dll is present, and the error only occurs AFTER an Oracle connection has been opened. I'm using an ADODB connection to connect to Oracle.
    I have tried closing the connection, and setting the connection object to nothing, but this doesn't seem to make any difference. The Oracle connection appears to be working fine, the recordsets that are returned have the correct data in them, and updates perform correctly as well.
    I have a sample application (about 175 lines of code) that I can use to consistantly reproduce the error.
    If anyone can shine some light on this, it would be greatly appreciated. If this needs to be posted to a different forum, please let me know that as well. This forum seemed to be the closest match that I could find for this problem.

    I am having the same problem, did you find an answer? other than resetting the Path, I shouldn't change all the client machines path

  • Lync 2013 Client and Outlook 2010

    Hi, I installed Lync 2013 (FE and Edge server). I am able to talk but still I need to buy suitable certificate in order to access from outside. Rest of the network is as follow. SBS 2011 with exchange 2010, clients have Office 2010.
    Problems that I noticed are:
    - If in Calelendar there is appointment, Lync client shows still available
    - Lync meeting button doesn't react when pressed.
    Is Lync 2013 client backward compatible with older office/Exchange or not ?
     

    For presence show doesn't integrate with outlook, Verify that the
    Lync Meeting Add-in for Microsoft Office is installed and enabled in Microsoft Outlook.
    For lync 2013 client compatible with office and Exchange, you can refer below link
    http://technet.microsoft.com/en-us/library/gg412817.aspx
    Please remember, if you see a post that helped you please click "Vote As Helpful" and if it answered your question, please click "Mark As Answer"
    Mai Ali | My blog: Technical

  • Oracle 8.1.5 (6?) interoperability with Java/C++ clients and various ORBs

    Hi
    Machine/OS: SGI VWS 540, 256MB RAM, Win2000
    Oracle: Oracle 8i (8.1.6)/Enterprise Edition Release 2
    Problem:
    I want to bind to a CORBA object (pureCORBA bank example) from c++.
    I found in the FAQ an article about the interoperability with c++. I downloaded an archieve with all the necessary code. But....
    I won't compile. It has been tested on Visibroker 3.2, but now i get compilation errors... (GIOP::ObjectKey CORBA::OctetSequence convertion).
    Is there an update of this article that uses 8i 8.1.6 and Visibroker 3.4 (that ships with 8.1.6). I compile it using MS VC++ 6.0 SP 4.
    I can make the current files compile, but then get a link error (login.lib uses stuff already defined in msvcrt.lib ....)
    Thank you
    Bart De Lathouwer

    Hi
    Machine/OS: SGI VWS 540, 256MB RAM, Win2000
    Oracle: Oracle 8i (8.1.6)/Enterprise Edition Release 2
    Problem:
    I want to bind to a CORBA object (pureCORBA bank example) from c++.
    I found in the FAQ an article about the interoperability with c++. I downloaded an archieve with all the necessary code. But....
    I won't compile. It has been tested on Visibroker 3.2, but now i get compilation errors... (GIOP::ObjectKey CORBA::OctetSequence convertion).
    Is there an update of this article that uses 8i 8.1.6 and Visibroker 3.4 (that ships with 8.1.6). I compile it using MS VC++ 6.0 SP 4.
    I can make the current files compile, but then get a link error (login.lib uses stuff already defined in msvcrt.lib ....)
    Thank you
    Bart De Lathouwer

  • Java sms client

    Is it possible to send messages between a java sms client and a java sms client? If it is, how ?

    As far as I know you don't have access to SMS in J2ME. You may be able to do some things like detect SMSs, but probably not as much as you want.

  • Problem with Java and Outlook

    I am having a problem with the Java plug-in and Microsoft Outlook 2003. When I have Outlook running, going to certain websites (like cbs.sportsline.com/collegefootball) will crash my browser (IE). I get a message like this:
    An unexpected exception has been detected in native code outside the VM.
    Unexpected Signal : unknown exception code (0xe06d7363) occurred at PC=0x77E73887
    Function=RaiseException+0x50
    Library=C:\WINDOWS\system32\kernel32.dll
    There is much more to the error message which appears as a text file on my desktop. If I close Outlook and try to go to that same CBS site, it works just fine. Has anyone else experienced this? Is there a solution?

    In Window, the dlls are not private to one
    application. They are logically shared. Not true in the sense that would affect this. DLL Text (code, read-only data in some cases) is shared. DLL Writable data is NOT shared between apps - each app gets its own copy of the data pages.
    However, it's possible that when Outlook runs, it interacts with IE (which has deep tentacles into the system) in such a way that when Java calls into native IE code, it is affected as an innocent bystander.
    Make sure you also install all the Office patches. If that doesn't help, try upgrading your Java VM to the latest version (you are using the Sun VM, right?).

  • If I install the Mail server on a Mac Mini as a server, can my users utilize Outlook as their mail client and how will it be different for them?

    If I install the Mail server on a Mac Mini as a server, can my users utilize Outlook as their mail client and how will it be different for them?

    Your users can utilize Outlook no matter where your email is hosted at.
    how will it be different for them
    different from what?

  • Setting up a mail client and the outgoing SMTP set...

    If you switch to BT and you already have email accounts set up in a mail client such as Mac Mail, you will not find any help from BT to set up correct outgoing SMTP mail server settings. Most other ISP's are usually very helpful with this but BT have a policy that is designed to make things very difficult to use anything but a BT email account. They claim that it is "To protect our email server from abuse by spammers". However, the solution to this has potentially quite the opposite effect as you will not be able to enable SSL for it to work!!
    OK so the first thing to do is create a new 'MY BT' account and then go to 'email' and create a new BT email account. Keep a note of address and password as you will need this later.
    Go back to the main BT home page and click on mail. You should land on a page that has the new 'BT Mail Account' in the left column and above a purple tool bar with 'Settings at the end. Click on 'Settings'.
    In the left column, underneath 'Mail' click on 'Accounts'
    Click 'Add' and fill in the details of your 3rd party (Non BT) account. They encourage IMAP only but I used 'POP" with no problems as I have no intention of using the BT mail client.
    In 'Mail settings' fill out the mail server details from your email provider or where your site is actually hosted. For example if you are using 000webhost.com then they will advise 'mx.000webhost.com' or may be 'mail.yourwebsitename' 
    The correct port to enter is the port listed in your web client. For me with Mac Mail then this is listed in preferences and if you check this then also double check that use SSL is NOT checked
    Enter the email user name and password of your 3rd party account
    Make sure in 'Security' that 'Requires SSL' is NOT checked
    Then save the account
    Click on the 'Email' link in the purple tool bar and there now under the 'BT Mail Account' should be your 3rd party account. Click on it and it should now load your email. If it doesn't then you will have to try again the steps above as there is no point in going any further if the BT client cannot access your account.
    OK if it is working then go to your email client (Mac Mail in my case) and in preference set up your 3rd party account as follows.
    Incoming mail server is as the info from your host ( like as in 'mx.000webhost.com' above). Enter user name and password for the 3rd party account.
    Now set up an Outgoing mail server (SMPT). I just called it BT with the server name 'mail.btinternet.com'. In the advance section click use default ports. It actually uses 465 if you do not have a default option.
    Do NOT enable SSL
    Set Authentication to 'Password'
    Then in user name enter the details of the NEW BT account you opened for user name and password.
    And that's it. Well it works for me! I got no assistance whatsoever from BT in trying to solve this. I asked to cancel my new BT infinity service after only 5 days when it proved so difficult to get an email client like mac mail to work. I had 4 calls from them and even the 'Tech Experts' had no idea what I was talking to them about!

    Melski wrote:
    Ah yes Thank you Oliver that is a better solution. However all the settings in the BT client have to remain as no SSL. If you change to use SSL there you will not be able access the 3rd party email account.
    Your email client cannot handle SSL for SMTP (BT) and non-SSL for POP3 (000webhost)?
    Oliver.

  • Java proxy client logical port transport to Q and prod issue in target addr

    Hi All,
    I have a java proxy client having a logical port (configured using NWDS) to consume a web service in the provider system.
    In the logical port, I have given target address, and logical port name. While moving this client proxy NWDI dev track to Q and prod,
    how do I change this target address to point to Q and prod respectively. In other words, even though I am using Visual admin to configure the destination url for the logical port, to point to Q and prod, its still referring to the dev environment provider service after moving the proxy client to Q and prod. What is the suggested approach to take care of this issue
    Thx
    mike

    Hi Michael,
    I can only help from that point of view that I believe this question belongs to the forum
    Service-Oriented Architecture (SOA) and SAP
    Please try to raise this question there.
    Thanks and Regards,
    Ervin

  • Cannot load Java plug-in and access R12 Oracle form from client

    Hi, one of my user cannot open Oracle form when accessing R12 environment using IE6. After selecting responsibility and menu, it got stuck after 50% processing when trying to load Java applet. It never got completed even after waiting for 2-3 hours.
    Is there any browser setting that needs to be modified? I checked popup blocker and activeX setting. All seem to be in order. Kindly assist. Thanks.

    Hi,
    What is the difference between this client and other clients?
    Delete the browser cache/history files and check then. If this does not help, enable trace for JRE (as per Note: 549423.1 - How to enable tracing and logging for Sun JRE (Native Plug-in)) and see if it shows any errors when you encounter this issue.
    Regards,
    Hussein

  • Socket Communication between java client and c++ server

    HI,
    In my project,I want to do the following:
    1.Sending datas from client to server.
    2.Getting the response from server to client.
    I written the client in java.but the server is in c++.
    Is it possible to communicate with the server using java codings itself?
    Im able to send the data from my java client to the server.
    but unable to get back the datas from server to client.
    Can anyone tell me how to do this?
    thanks a lot

    hi
    thanks for ur reply.
    I didnt get any error msg while getting the back the datas.
    Actually i divided my application into two parts.
    My application will act as both server and client.
    server ll get the browser request and send to the client and the client will send that data to the c++ server.
    Im able to do that.and unable to get the data from server.
    Didnt get any error.
    can u tell me how to make an application to act as both client and server.
    I think im wrong in that part.
    thanks a lot

  • BC4J and OAS with Java Application Client

    Could you show me an example about using the BC4J and OAS with Java Application client.
    The JDeveloper Help is not enough to solve this kind of problem.
    Configuration:
    Jdeveloper 3.1
    OAS 4.0.8.1
    Database 7.3.4
    null

    if you can logon with client tools then that should be an indication that the service account running the CMS IS working! Good news.
    So the problem is likely with the java portion (krb5/bsclogin or java options)
    If the files are in c:\winnt\ (if not copy them there) and perform c:\program files\business objects\javasdk\bin\kinit username
    then enter and password/enter again
    Probably get the same message. To note in your krb5.ini all domain info must be in CAPS (the .com appears to be in lower case)
    kinit works with just the krb5.ini, java SDK and AD (removing BO config and the service account from the picture). Once that works if your java options are specified properly you should be able to login to CMC/infoview.
    also 1 last point. Add udp_preference_limit = 1 to the krb5 lib defaults section
    libdefaults
    default_realm = BD.com
    dns_lookup_kdc = true
    dns_lookup_realm = true
    udp_preference_limit = 1
    Regards,
    Tim

  • Can I run a Unique Clients and Users Summary report customized by both floor area and SSID?

    In Cisco Prime, can I run a Unique Clients and Users Summary report customized by both floor area and SSID?

    Allright guys. I appreciate the quick responses. I've worked a lot in CR however i am not understanding the solution so I'd appreciate if you can dumb it down for me. If i understand it correctly you guys are suggesting to make a formula, that either return my group by string (which is a formula in my report) or the Quantity. I tried writing a formula like this
    if ({@param} = 1 then
    GroupName ({@GroupBy})
    else
    {NetPNL.GrossAfterAdj}
    but it seems like CR does not allow you to return 2 different data types. Even if it had worked i would not know what to do from there. Can anyone please dumb it down for me. To make my situation more clear below is an example of how my data is..
    MN 100
    MN 200
    MN 50
    CA 300
    CA 500
    when the data shows in the report, its grouped by state, so it comes out like
    MN 350
    CA 800
    I want the users to decide whether they want it sorted by state  (ascending)
    CA 800
    MN 350
    or Total quantity (asc)
    MN 350
    CA 800

  • TS3276 Hi there I am having trouble with my outlook express this is the first time it has happened it keeps telling me can't connect to the SMTP server and every password I have tried is incorrect this is for 'iCloud' very frustrating as all our phones ar

    Hi there I am having trouble with my outlook express this is the first time it has happened it keeps telling me can't connect to the SMTP server and every password I have tried is incorrect this is for 'iCloud' very frustrating as all our phones are ok

    Well I am feeling a bit silly now because that was all I had to do. In the past Workgroup Manager had always opened right up to the list of my users, I never even thought to click on that but apparently that was all that was needed.
    I still am not sure how the iChat Server preferences changed themselves on me, but it is not the first time I have had weird "settings" issues with our Snow Leopard Server.
    Thanks!

  • Anyone else haveing a problem with appointments not syncing, duplicate appointments when syncing with Outlook? Also, noticed that my primary SMTP disappeared, and I had to re-establish to send e-mail. Apple tech support was worthless.

    Anyone else haveing a problem with appointments not syncing, duplicate appointments when syncing with Outlook? Noticed the problem a couple of days ago.
    Also, noticed that my primary SMTP disappeared, and I had to re-establish to send e-mail.
    Apple tech support was worthless on both issues.

    Hi I am also in the UK, but not with Tiscali and am having the exact same problems. I can also send with wifi, but not 3G. I have tried amending all sorts of settings, including those above and amending the smtp server to the settings for my provider, but all to no avail.
    It is thoroughly frustrating, as I cannot send emails unless I have wifi access.
    Any further suggestions would be very welcome.

Maybe you are looking for

  • What is the best way to make a DVD from iMovie

    What is the best way to make a DVD from iMovie? I am using iMovie 06 (Naturally) with iDVD 08. I have always used; iMovie 06, File > Share to iDVD 08. And got pretty good results. Some say the best way is to quit iMovie 06, open iDVD and import the m

  • Date problem with jasper reports

    I need to pass the date values as a parameter to the jasper reports and process it in the report, how can achieve it please give me a brief explanation, i need the date value for processing a sql statement in the jasper report please help me a sample

  • More no. of column Vs. 1 CLOB Column

    Hi, I had an requirement like, I have to store 28 attributes. [id, time, flag....etc] Initially I have created 28 columns in the table and storing the data. Meanwhile, I got fired and thinking that to implement 1 CLOB Column to store all the data and

  • Client and transport requests

    hi frnds, in the dev system we have two clients 900,500. now i want that the reqeuests which are seen in 900 clilent (se10)  should also be seen in 500. how is it possible. regards, bhupesh

  • Most of my apps won't open on my ipod after they updated.

    Could this be a virus or does anyone know why this would happen?