How to use java mail to send email to hotmail box

how to use java mail to send email to hotmail box??
i can send emails to other box(my company's email account) but for hotmail, the program didnt print any err or exception the recepient cant receive the mail.
thanks

you ust to download activation.jar and mail.jar and add them to your build path.
i have used the googlemail smtp server to send mail the code is following:
public void SendMail()
Properties props = new Properties();
props.put("mail.smtp.user", username);
props.put("mail.smtp.host", host);
props.put("mail.smtp.port", port);
props.put("mail.smtp.starttls.enable","true");
props.put("mail.smtp.auth", "true");
props.put("mail.smtp.socketFactory.port", port);
try{
     Authenticator auth = new SMTPAuthenticator(username,password);
Session session = Session.getInstance(props, auth);
MimeMessage msg = new MimeMessage(session);
msg.setText(text);
msg.setSubject(subject);
msg.setFrom(new InternetAddress(senderEmail));
msg.addRecipient(Message.RecipientType.TO, new InternetAddress(receiver));
Transport.send(msg);
}catch(Exception ex) {
     System.out.println("Error Sending:");
System.out.println(ex.getMessage().toString());
and this the SMTPAuthenticator Class which you will need too.
class SMTPAuthenticator extends javax.mail.Authenticator {
     private String fUser;
     private String fPassword;
     public SMTPAuthenticator(String user, String password) {
     fUser = user;
     fPassword = password;
     public PasswordAuthentication getPasswordAuthentication() {
     return new PasswordAuthentication(fUser, fPassword);
     }

Similar Messages

  • How to use Yahoo Mail to send email using email links on webpages

    When I'm on a webpage that has a link to send an email, I cut and paste the the email address (which is the link) and paste it into my Yahoo Mail address bar. However, some webpages don't show the email address as a link. Instead, the link might be "write me" or "send mail", so I can't cut and paste an address.
    If I click on an email link, a window pops up that says "Welcome to Mail" and it states that the assistant will guide me through the steps to configure my email account. To get started, this assistant requires a password that I don't possess.
    So I'm stuck not being able to access an email application that I don't want to use in the first place.
    Is there a way to set up my computer so that I could click an email link on a webpage and have Yahoo Mail pop up?
    If not, is there at least a way to send an email using an email link that doesn't show the email address, without using (what I assume to be) the Apple mail Application? If it is necessary, how do I recover the password for the mail assistant? I'm not aware of ever having used or set up a password before.
    THANK YOU

    If you don't want Mail to open, don't click on the app.  If it's opening at login, right click its Dock icon>Option>de-select Open at Login.

  • HT4864 I am using Direct Mail to send emails to the people in my organization, the problem is i don't know how to connect it with my iCloud account, does anyone know how?

    I am usind direct mail to send emails, problem is that when i put hthe STMP server and port number it does not log me in.
    does anyone know how?

    iCloud is a mail system, it neither needs nor will use someone elses email transport.

  • How to use Java Mail API in Unix

    I am trying to write some code using Java mail API. I want to execute it in Unix. I downloaded the mail API to windows machine and ftped the mail.jar file to a Unix machine. Then I set the class path as below:
    export CLASSPATH=$CLASSPATH:/home.../mail.jar
    Then I tried to compile my Java program. The output is as below:
    error: error reading /home.../mail.jar; invalid END header (bad central directory offset)
    mail.java:1: package javax.mail does not exist
    import javax.mail.*;
    Can any one please help me out.

    You should also include the "activation.jar" file that you obtained from
    downloading the Java Activation Framework, in your CLASSPATH.
    For example:
    export CLASSPATH=$CLASSPATH:/urPath/activation/activation.jar
    Besides, assuming you unzipped javamail-1_4_1.zip in home/download the following should work
    export CLASSPATH=$CLASSPATH:home/download/javamail-1.4.1/mail.jar:.

  • How can I force Mail to send email requesting a server DSN?

    I would like mail to send every message with a server DSN request (the RFC1891 type). I found "tech savvy" info on this archived thread:
    https://discussions.apple.com/thread/1965944?start=0&tstart=0
    But, I am not a technical person, so, how can I get mail to do this in practise? Or would there be a utility/add-on/plug-in that allows for this?

    First thing to try: go to System Preferences>iCloud and uncheck 'Mail' in the list there. Then re-check it. Give it time to settle in. Go to Mail Preferences>Accounts (not 'Accounts' in the 'Mail' menu) and select your iCloud account. You should see this:
    'Email address' (greyed out) is your login - this should be your @me.com address. The 'Alias' drop-down menu should both versions of your address - @me.com and @icloud.com/ - plus any aliases you have set up.
    (the image is from Mavericks, I would expect Yosemite to be much the same).
    If this hasn't worked, try clicking the Sign Out button in System Preferences>iCloud. It wouldn't hurt to reboot; then sign back in again. Your iCloud synced data will disappear when you sign out but will reappear when you sign back in (give it time).

  • How to use Apple Mail to send outgoing emails only?

    Hello,
    I haven't been able to find exactly what I'm looking for elsewhere on the interwebs.
    I want to be able to set up the Apple Mail app on my Mac to send outgoing emails only from my Gmail account. I use the Gmail website and my iPhone for sending/receiving emails and I don't want or have a need for all of my Gmail emails to be downloaded into the Apple Mail app or for new emails to appear in the Mail app as they come in.
    I just want to be able to send outgoing emails from the app so that I can send photos directly from iPhoto using the Email button. Any help is greatly appreciated!

    Great news, thanks!

  • Huge problem using apple mail while sending email to a group...

    Hey - I am quite confused... apple mail has huge problems using groups with about 150 addresses when writing and sending an email... the writing of emails is nearly impossible. Once the group name is inserted in the addressline (address book in iCloud!), apple mail uses nearly 100% CPU and further writing is nearly impossible. When sending such an email, all addresses are suddenly visible - though the box is NOT checked and the addresses should be hidden... what can I do? I use this feature (sending mails to groups) on a daily basis and cannot accept visible addresses...
    Greetings and sorry for inconvenient english...
    Christof

    How about next time you send to the group, cc yourself, or include yourself in the group. Then receive the email on the iphone, you can "reply all" in order to send to the group. If you use an imap account, you can make a new folder, call it something like "groups", and save different group emails there for the next time you need to "reply all".

  • How to use RSCONN01 to selectively send email by sender or group?

    We have two different email needs: one (work requests)to be sent nearly immediately and the second (payment advices) to be sent overnight.  How can we accomplish this?

    hi
    good
    go through these links, i hope these ll help you to solve your problem.
    http://help.sap.com/saphelp_nw2004s/helpdata/en/d4/0d2041098def23e10000000a155106/content.htm
    /people/thomas.jung3/blog/2004/09/08/sending-e-mail-from-abap--version-610-and-higher--bcs-interface
    thanks
    mrutyun^

  • How do you tell Mail to send email?

    Sometimes stuff gets stuck in the outbox. Forced quit and reboot does not get the outbox mail sent.
    Each letter must be opened and receive a new sent time, sometimes the next day, to get it to send if it is not lost altogether.

    Snow Leopard solved the problem.

  • Error of using Java Mail in Web Start

    Hi,
    I got a problem when using Java Mail to send email. My apps is a stand alone and no problem when it was deployed normally. When I used the Web Start to deploy it, the following error was caught when I tried to send email:
    javax.activation.UnsupportedDataTypeException: no object DCH for MIME type multipart/mixed; boundary="----=_Part_0_2824645.1032281188963"
         at javax.activation.ObjectDataContentHandler.writeTo(DataHandler.java:851)
         at javax.activation.DataHandler.writeTo(DataHandler.java:305)
         at javax.mail.internet.MimeBodyPart.writeTo(MimeBodyPart.java:1089)
         at javax.mail.internet.MimeMessage.writeTo(MimeMessage.java:1527)
    at com.sun.mail.smtp.SMTPTransport.sendMessage(SMTPTransport.java:321)
         at javax.mail.Transport.send0(Transport.java:164)
         at javax.mail.Transport.send(Transport.java:81)
         at com.mailcom.client.util.EMail.sendMail(EMail.java:180)
    Here is the source code:
    public class EMail {
    public static void sendMail(String host,
    String sender,
    String recipient,
    String subject,
    String content,
    Vector fileNames) throws MessagingException {
    Properties props = new Properties();
    props.put("mail.smtp.host",host);
    Session session = Session.getDefaultInstance(props,null);
    session.setDebug(true);
    Message msg = new MimeMessage(session);
    msg.setFrom(new InternetAddress(sender));
    msg.setRecipients(Message.RecipientType.TO, InternetAddress.parse(recipient,false));
    msg.setSubject(subject);
    Multipart mp = new MimeMultipart();
         // create and fill the first message part
         MimeBodyPart mbp1 = new MimeBodyPart();
         mbp1.setText(content);
         mp.addBodyPart(mbp1);
    // attach the file to the message
    if(fileNames != null && fileNames.size() != 0) {
    FileDataSource fds = null;
    for(int i = 0; i < fileNames.size(); i++ ) {
    String currentFileName = (String)fileNames.elementAt(i);
         fds = new FileDataSource(currentFileName);
         // create the second message part
         MimeBodyPart mbp2 = new MimeBodyPart();
         mbp2.setDataHandler(new DataHandler(fds));
         mbp2.setFileName(fds.getName());
         // create the Multipart and its parts to it
         mp.addBodyPart(mbp2);
         // add the Multipart to the message
         msg.setContent(mp);
    msg.setHeader("X-Mailer",MAILER);
         // set the Date: header
         msg.setSentDate(new Date());
         // send the message
    line 180     Transport.send(msg);

    Yes. All the third party jar files and our application jar are put on the server side. Here is the JNLP file:
    <?xml version="1.0" encoding="utf-8"?>
    <!-- JNLP File for software-->
    <jnlp spec="1.0+" codebase="http://www.software.com/apps" href="client.JNLP">
    <information>
    <title>client application</title>
    <vendor> * </vendor>
    <homepage href="docs/help.html"/>
    <description>Client</description>
    <description kind="short">A tool</description>
    <icon href="images/logo.jpg"/>
    <offline-allowed/>
    </information>
    <security>
    <all-permissions/>
    </security>
    <resources>
    <j2se version="1.3"/>
    <jar href="lib/client.jar"/>
    <jar href="lib/mail.jar"/>
    <jar href="lib/smtp.jar"/>
    <jar href="lib/activation.jar"/>
    </resources>
    <application-desc main-class="com.software.client.MainFrame">
         <argument>2226</argument>
         <argument>www.software.com</argument>
         <argument>5351</argument>
    </application>
    </jnlp>

  • Attach multiple emails to one master email using Java mail API

    Java version: JDK 1.5.0_15
    Hi,
    I am using Java API to send email using our corporate microsoft exchange server. Everything is working fine, now I have a requirement to attach multiple emails to one master email and send.
    Question:
    Using JAVA API is it possible to attach multiple emails to one email?
    Regards,
    Arup

    The beginning of this FAQ entry tells you how to attach one message to another message:
    http://www.oracle.com/technetwork/java/javamail/faq/index.html#forward

  • How to send HTML Format Mail using Java Mail in oracle 9i Forms

    Dear All
    could you please tell me how to send HTML Format Mail using Java Mail in oracle 9i Forms and how to implement the java mail ?
    if it is possible, could you please send me the sample code? please very urgent
    Thanks
    P.Sivaraman

    Hello,
    <p>Here is a Form sample.</p>
    Francois

  • How to send Secured Mail using Java Mail?

    I want to send mails with "Send Secure" option using Java Mail. Now mails are being sent using Java Mail connecting to smtp host.
    Appreciating your help.
    Thanks.

    There are third party libraries to help with this. Bouncy Castle is very popular.
    See the [JavaMail Third Party Products|http://java.sun.com/products/javamail/Third_Party.html] page.

  • How to do SAVE AS DRAFT using java mail api

    Hello,
    I want to know how to do SAVE AS DRAFT using Java mail Api.
    thanks

    Hello,
    I want to know how to do SAVE AS DRAFT using Java
    mail Api.
    thanksI don't think you can. That sounds like a feature of a mail client app itself. The Java mail API is for when you're ready to actually send the thing. Saving drafts is storing them somewhere like you would any other data; nothing to do with the mail API.

  • How can i access gmail's smtp server using java mail api

    i m using java mail api to access gmails pop and smtp service to receive and send mail from ur gmail account. I m able to access gmails pop server using the ssl and port 995 , but i can not use its smtp server to which i m connecting using ssl on 465 port. It requires authentication code.
    if anybody can help me in this regard i m thnkful to him/her.
    thnks in advance.
    jogin desai

    Here's an example of using SSL + Authentication
    http://onesearch.sun.com/search/onesearch/index.jsp?qt=ssl+authentication&subCat=siteforumid%3Ajava43&site=dev&dftab=siteforumid%3Ajava43&chooseCat=javaall&col=developer-forums

Maybe you are looking for

  • HT5312 How can i create a rescue email

    How can i create a rescue email

  • ITunes and Digital Media Center?

    I am looking for a Digital Media Center as a replacement for my CD Juke Box that can organize music, photos, videos, etc - has anyone done that - or is there a manufacturer that makes one available? Everything that I have found runs Windows Media Cen

  • How to set queue name thru JCD

    Hi All, I have a scenario where depending on Input message type tag I have to send message to respective queue. Please advise me on this if any body have idea / worked on it. Thanks in advance.

  • How to show tracking bubbles in pages for Pad

    I've just received a document that has been corrected in Pages with track changes on, but when I open it in pages on the iPad, I can see the corrections but I can't see the tracking bubbles to accept or reject the changes- How do I turn them on? Trac

  • Disk format error running Snow Leopard

    Hi all, simply trying to erase/reformat a LaCie 350 GB external hard drive.    I keep getting the error that the disk won't unmount. How can I get around this and does this mean I shouldn't rely on this EHD. I'm reformatting it to load up some video