Email without javamail api

Is there any way to send email with java without using the javamail api
regards
fightspam

Try this
import java.net.*;
import java.util.*;
import java.io.*;
public class email
    private static final String host="smtp.smtphost.co.uk";
    private static final String to="[email protected]";
    private static final String subject="autogenerated message";
    static void send(String message)
        try
            System.getProperties().put("mail.host",host);
            URL url = new URL("mailto:" + to);
            URLConnection connection = url.openConnection();
            connection.setDoInput(false);
            connection.setDoOutput(true);
            connection.connect();
            PrintWriter out = new PrintWriter(new OutputStreamWriter(connection.getOutputStream()));
            out.print("From: <"+InetAddress.getLocalHost().getHostName()+">\n");
            out.print("To: "+to+"\n");
            out.print("Subject: "+subject+"\n");
            out.print("\n");
            out.print(message);
            out.close();
        catch (Exception e)
    public static void main(String[] args)
        for(int i=0;i<10;i++)
            send("this is a test message");
}

Similar Messages

  • Order, Paginate and List  emails in JavaMail API

    Am able to sendm and retrieve emails in java using JavaMail API but am having a problem. I would like to sort emails by date, subject, sender etc and also display only a subset of emails using pagination.
                Message[] msgs = folder.getMessages();
                FetchProfile fp = new FetchProfile();
                fp.add(FetchProfile.Item.ENVELOPE);
                folder.fetch(msgs, fp);The function folder.getMessages(); can take 2 arguments (from_index,to_index), but this is according to the way mail server will transalate. POP server will arrange by date while IMAP is unordered. I would like to order the mails then fetch the getMessages(from_index,to_index).
    Another posible way am seeing is fetching all mesages using getMessages() put them in a temporary storage(eg. vector or list), order them and then fetch only the page i want. But this could be very costly in terms of processing resources, which makes me believe there is a better approach and it seems i cant find it.
    Can somenone please advice me on what to do. I will be very greatful.
    Edited by: kagara on Aug 27, 2008 12:27 PM

    With POP3 you have no choice but to download the messages and sort them in the client.
    The POP3 protocol simply doesn't provide a "sort" option.
    With IMAP, some IMAP servers support a "SORT" extension, although JavaMail doesn't
    support it yet.

  • Issues with signing an Email with JavaMail Api and BouncyCastle provider

    Hi everyone
    I am getting this strange error which I can not figure out what is it about.
    Exception in thread "main" java.lang.NoSuchFieldError: id_alg_CMS3DESwrap
         at org.bouncycastle.cms.CMSEnvelopedGenerator.<clinit>(Unknown Source)
         at org.bouncycastle.mail.smime.SMIMEGenerator.<clinit>(Unknown Source)
         at net.suberic.crypto.bouncycastle.SMIMEEncryptionUtils.signBodyPart(SMIMEEncryptionUtils.java:215)
         at net.suberic.crypto.bouncycastle.SMIMEEncryptionUtils.signMessage(SMIMEEncryptionUtils.java:257)
         at cityLocator.SignMessage.main(SignMessage.java:53)
    This is my code :
    public static void main(String[] argv) {
    try {
    Session mailSession = Session.getDefaultInstance(System.getProperties());
    MimeMessage newMessage = new MimeMessage(mailSession);
    String content = "This is a signed message. \n\nYou know it has actually been sent by this fictional person.\n\nImagine if you received an email claiming to be from this nonexistent person, but was actually from some other made-up persona? That would be bad.\n\n";
    newMessage.setContent(content, "text/plain");
    newMessage.setFrom();
    newMessage.setRecipients(Message.RecipientType.TO, "[email protected]");
    newMessage.setSubject("This one is signed.");
    newMessage.saveChanges();
    // get our signer(s)
    EncryptionUtils smimeUtils = EncryptionManager.getEncryptionUtils(EncryptionManager.SMIME);
    // load the associated store(s)
    char[] smimePw = new String("********").toCharArray();
    EncryptionKeyManager smimeKeyMgr = smimeUtils.createKeyManager();
    smimeKeyMgr.loadPrivateKeystore(new FileInputStream(new File("Dmcave1.pfx")), smimePw);
    smimeKeyMgr.loadPublicKeystore(new FileInputStream(new File("Dmcave1.pfx")), smimePw);
    java.security.Key smimeKey = smimeKeyMgr.getPrivateKey("***************", smimePw2);
    MimeMessage smimeSignedMsg = smimeUtils.signMessage(mailSession, newMessage, smimeKey);
    Error is here--> smimeSignedMsg.writeTo(new com.sun.mail.util.CRLFOutputStream(new FileOutputStream(new File("smimeSigned.msg"))));
    MimeMessage pgpSignedMsg = pgpUtils.signMessage(mailSession, newMessage, pgpKey);
    } catch (Exception e) {
    e.printStackTrace();
    Any ideas or helps would be appreciated

    Hi everyone
    I am getting this strange error which I can not figure out what is it about.
    Exception in thread "main" java.lang.NoSuchFieldError: id_alg_CMS3DESwrap
         at org.bouncycastle.cms.CMSEnvelopedGenerator.<clinit>(Unknown Source)
         at org.bouncycastle.mail.smime.SMIMEGenerator.<clinit>(Unknown Source)
         at net.suberic.crypto.bouncycastle.SMIMEEncryptionUtils.signBodyPart(SMIMEEncryptionUtils.java:215)
         at net.suberic.crypto.bouncycastle.SMIMEEncryptionUtils.signMessage(SMIMEEncryptionUtils.java:257)
         at cityLocator.SignMessage.main(SignMessage.java:53)
    This is my code :
    public static void main(String[] argv) {
    try {
    Session mailSession = Session.getDefaultInstance(System.getProperties());
    MimeMessage newMessage = new MimeMessage(mailSession);
    String content = "This is a signed message. \n\nYou know it has actually been sent by this fictional person.\n\nImagine if you received an email claiming to be from this nonexistent person, but was actually from some other made-up persona? That would be bad.\n\n";
    newMessage.setContent(content, "text/plain");
    newMessage.setFrom();
    newMessage.setRecipients(Message.RecipientType.TO, "[email protected]");
    newMessage.setSubject("This one is signed.");
    newMessage.saveChanges();
    // get our signer(s)
    EncryptionUtils smimeUtils = EncryptionManager.getEncryptionUtils(EncryptionManager.SMIME);
    // load the associated store(s)
    char[] smimePw = new String("********").toCharArray();
    EncryptionKeyManager smimeKeyMgr = smimeUtils.createKeyManager();
    smimeKeyMgr.loadPrivateKeystore(new FileInputStream(new File("Dmcave1.pfx")), smimePw);
    smimeKeyMgr.loadPublicKeystore(new FileInputStream(new File("Dmcave1.pfx")), smimePw);
    java.security.Key smimeKey = smimeKeyMgr.getPrivateKey("***************", smimePw2);
    MimeMessage smimeSignedMsg = smimeUtils.signMessage(mailSession, newMessage, smimeKey);
    Error is here--> smimeSignedMsg.writeTo(new com.sun.mail.util.CRLFOutputStream(new FileOutputStream(new File("smimeSigned.msg"))));
    MimeMessage pgpSignedMsg = pgpUtils.signMessage(mailSession, newMessage, pgpKey);
    } catch (Exception e) {
    e.printStackTrace();
    Any ideas or helps would be appreciated

  • JavaMail API for enabling email notification

    Hi
    I want to use JavaMail API for enabling email notification for an application. I have downloaded the javamail_1.4 zip file, unzipped it and set the CLASSPATH environment variable. JAVA_HOME isalso set. the activation.jar file from JAF is also in place. but, when i try to compile the sample programs (included with javamail) like smtpsend.java,msgsend.java, I get a screenful of errors all referring to "cannot find symbol", the main error being
    "package javax.mail does not exist". I guess, Java is not able to locate the package.
    Please suggest what can be done .Any tips for configuring email notification are more than welcome!
    Thanks!

    Are you compiling using the "javac" command,
    or are you using an IDE like Eclipse or NetBeans?
    In the latter case, you have to tell the IDE to
    add the jar files to your project.

  • Problem Sending mails in a loop using JavaMail API

    Hello All,
    I am sending emails in a loop(one after the other) using JavaMail API,but the problem is, if the first two,three email addresses in the loop are Valid it sends the Email Properly, but if the Fourth or so is Invalid Address it throws an Exception....
    "javax.mail.SendFailedException: Sending failed;"
    nested exception is:
    javax.mail.SendFailedException: Invalid Addresses;
    nested exception is:
    javax.mail.SendFailedException: 450 <[email protected]>:Recipient address rejected: Domain not found......
    So if i want to send hundereds of emails and if one of the Emails inbetween is Invalid the process Stops at that point and i could not send the other emails in the Loop......
    How Could i Trap the exception thrown and handle it in such a way, so that the loops continues ..
    Is there something with the SMTP Server....?
    The code which i am using is as follows....
    <Code>...
    try {
    InitialContext ic = new InitialContext();
    Session session = (Session) ic.lookup(JNDINames.MAIL_SESSION);
    if (Debug.debuggingOn)
    session.setDebug(true);
    // construct the message
    MimeMessage msg = new MimeMessage(session);
    msg.setFrom(new InternetAddress(eMess.getEmailSender()));
    String to = "";
    msg.setRecipients(Message.RecipientType.TO,
    InternetAddress.parse(to, false));
    msg.setRecipients(Message.RecipientType.BCC,
    InternetAddress.parse(eMess.getEmailReceiver(), false));
    msg.setSubject(eMess.getSubject());
    msg.setContent(eMess.getHtmlContents(),"text/plain");
    msg.saveChanges();                
    Transport.send(msg);
    } catch (Exception e) {
    Debug.print("createAndSendMail exception : " + e);
    throw new MailerAppException("Failure while sending mail");
    </Code>....
    Please give me any suggestions regarding it....and guide me accordingly..
    Thanks a million in advance...
    Regards
    Sam

    How about something like the code attached here. Be aware it is lifted and edited out of an app we have here so it may require changing to get it to work. If it don't work - don't come asking for help as this is only a rough example of one way of doing it. RTFM - that's how we worked it out!
    SH
    try {
    Transport.send(msg);
    // If we get to here then the mail went OK so update all the records in the email as sent
    System.out.println("Email sent OK");
    catch (MessagingException mex) {
    System.out.println("Message error");
    Exception ex = mex;
    do {
    if (ex instanceof SendFailedException) {
    if (ex.getMessage().startsWith("Sending failed")) {
    // Ignore this message as we want to know the real reason for failure
    // If we get an Invalid Address error or a Message partially delivered message process the message
    if (ex.getMessage().startsWith("Message partially delivered")
    || ex.getMessage().startsWith("Invalid Addresses")) {
    // This message is of interest as we need to process the actual individual addresses
    System.out.println(ex.getMessage().substring(0, ex.getMessage().indexOf(";")));
    // Now get the addresses from the SendFailedException
    SendFailedException sfex = (SendFailedException) ex;
    Address[] invalid = sfex.getInvalidAddresses();
    if (invalid != null) {
    System.out.println("Invalid Addresse(s) found -");
    if (invalid.length > 0) {
    for (int x = 0; x < invalid.length; x++) {
    System.out.println(invalid[x].toString().trim());
    Address[] validUnsent = sfex.getValidUnsentAddresses();
    if (validUnsent != null) {
    System.out.println("Valid Unsent Addresses found -");
    if (validUnsent.length > 0) {
    for (int x = 0; x < validUnsent.length; x++) {
    System.out.println(validUnsent[x].toString().trim());
    Address[] validSent = sfex.getValidSentAddresses();
    if (validSent != null) {
    System.out.println("Valid Sent Addresses found -");
    if (validSent.length > 0) {
    for (int x = 0; x < validSent.length; x++) {
    System.out.println(validSent[x].toString().trim());
    if (ex instanceof MessagingException)
    ex = ((MessagingException) ex).getNextException();
    else {
    // This is a general catch all and we should assume that no messages went and should stop
    System.out.println(ex.toString());
    throw ex;
    } while (ex != null);

  • Getting error when sending SMTP mail using javamail api

    hi all
    i am new to javamail api...and using it first-time....i'v used the following code
    <%
    String mailHost="mail.mastsale.com";
    String mailText="Hello this is a test msg";
    String to="<a href="mailto:[email protected]">[email protected]</a>";
    String subject="jsp test mail";
    try
    String from="<a href="mailto:[email protected]">[email protected]</a>";
    String mailhost = "mail.mastsale.com";
    Properties props = System.getProperties();
    props.put("mail.smtp.host", mailhost);
    // Get a Session object
    Authenticator auth = new SMTPAuthenticator( "<a href="mailto:[email protected]">[email protected]</a>", "abcd" );
    Session session1 = Session.getInstance(props,auth);
    //Session.setDebug(true);
    //construct message
    Message msg = new MimeMessage(session1);
    msg.setFrom(new InternetAddress(from,"Your Name"));
    msg.setRecipients(Message.RecipientType.TO, InternetAddress.parse(to, false));
    msg.setSubject(subject);
    msg.setText(mailText);
    //msg.setHeader("X-Mailer",mailer);
    msg.setSentDate(new Date());
    msg.saveChanges();
    //Send the message
    out.println("Sending mail to " + to);
    Transport.send(msg);
    catch (MessagingException me)
    out.println("Error in sending message for messaging exception:"+me);
    %>
    and
    SMTPAuthenticator.java
    import java.io.*;
    import java.util.*;
    import java.lang.*;
    import javax.mail.*;
    import javax.mail.internet.*;
    public 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);
    Now getting error as: Error in sending message for messaging exception:javax.mail.SendFailedException: Invalid Addresses; nested exception is: com.sun.mail.smtp.SMTPAddressFailedException: 550-(host.hostonwin.com) [208.101.41.106] is currently not permitted to relay 550-through this server. Perhaps you have not logged into the pop/imap server 550-in the last 30 minutes or do not have SMTP Authentication turned on in your 550 email client.
    Can anyone help me?

    i got the following error while using the below code,
    -----------registerForm----------------
    DEBUG: setDebug: JavaMail version 1.3.2
    DEBUG: getProvider() returning javax.mail.Provider[TRANSPORT,smtp,com.sun.mail.smtp.SMTPTransport,Sun Microsystems, Inc]
    DEBUG SMTP: useEhlo true, useAuth true
    :::::::::::::::::::::::::::::::::<FONT SIZE=4 COLOR="blue"> <B>Error : </B><BR><HR> <FONT SIZE=3 COLOR="black">javax.mail.AuthenticationFailedException<BR><HR>
    -----------registerForm----------------
    public class SendMailBean {
    public String send(String p_from, String p_to, String p_cc, String p_bcc,
    String p_subject, String p_message, String p_smtpServer,String FilePath) {
    String l_result = "";
    // Name of the Host machine where the SMTP server is running
    String l_host = p_smtpServer;
    //for file attachment
    String filename = FilePath;
    // Gets the System properties
    Properties l_props = System.getProperties();
    // Puts the SMTP server name to properties object
    l_props.put("mail.smtp.host", l_host);
    l_props.put("mail.smtp.auth", "true");
    // Get the default Session using Properties Object
    Session l_session = Session.getDefaultInstance(l_props, null);
    l_session.setDebug(true); // Enable the debug mode
    try {
    MimeMessage l_msg = new MimeMessage(l_session); // Create a New message
    l_msg.setFrom(new InternetAddress(p_from)); // Set the From address
    // Setting the "To recipients" addresses
    l_msg.setRecipients(Message.RecipientType.TO,
    InternetAddress.parse(p_to, false));
    // Setting the "Cc recipients" addresses
    l_msg.setRecipients(Message.RecipientType.CC,
    InternetAddress.parse(p_cc, false));
    // Setting the "BCc recipients" addresses
    l_msg.setRecipients(Message.RecipientType.BCC,
    InternetAddress.parse(p_bcc, false));
    l_msg.setSubject(p_subject); // Sets the Subject
    // Create and fill the first message part
    MimeBodyPart l_mbp = new MimeBodyPart();
    //123
    ///////l_mbp.setText(p_message);
    l_mbp.setContent(p_message,"text/html");
    // Create the Multipart and its parts to it
    Multipart l_mp = new MimeMultipart();
         //l_mp.setContent(html,"text/html");
    l_mp.addBodyPart(l_mbp);
    // Add the Multipart to the message
    l_msg.setContent(l_mp,"text/html");
    // Set the Date: header
    l_msg.setSentDate(new Date());
    //added by cibijaybalan for file attachment
         // attach the file to the message
    //Multipart l_mp1 = new MimeMultipart();
         if(!filename.equals(""))
                   String fname = filename;
                   MimeBodyPart mbp2 = new MimeBodyPart();
                   FileDataSource fds = new FileDataSource(fname);
                   mbp2.setDataHandler(new DataHandler(fds));
                   mbp2.setFileName(fds.getName());
                   l_mp.addBodyPart(mbp2);
              // add the Multipart to the message
              l_msg.setContent(l_mp);
    //ends here
         l_msg.setSentDate(new java.util.Date());
    // Send the message
    Transport.send(l_msg);
    // If here, then message is successfully sent.
    // Display Success message
    l_result = l_result + "Mail was successfully sent to : "+p_to;
    //if CCed then, add html for displaying info
    //if (!p_cc.equals(""))
    //l_result = l_result +"<FONT color=green><B>CCed To </B></FONT>: "+p_cc+"<BR>";
    //if BCCed then, add html for displaying info
    //if (!p_bcc.equals(""))
    //l_result = l_result +"<FONT color=green><B>BCCed To </B></FONT>: "+p_bcc ;
    //l_result = l_result+"<BR><HR>";
    } catch (MessagingException mex) { // Trap the MessagingException Error
    // If here, then error in sending Mail. Display Error message.
    l_result = l_result + "<FONT SIZE=4 COLOR=\"blue\"> <B>Error : </B><BR><HR> "+
    "<FONT SIZE=3 COLOR=\"black\">"+mex.toString()+"<BR><HR>";
    } catch (Exception e) {
    // If here, then error in sending Mail. Display Error message.
    l_result = l_result + "<FONT SIZE=4 COLOR=\"blue\"> <B>Error : </B><BR><HR> "+
    "<FONT SIZE=3 COLOR=\"black\">"+e.toString()+"<BR><HR>";
    e.printStackTrace();
    }//end catch block
    //finally {
    System.out.println(":::::::::::::::::::::::::::::::::"+l_result);
    return l_result;
    } // end of method send
    } //end of bean
    plz help me

  • How to read emails using javamail

    hello friends
    well i am working on a project on phishing for that i had usinf javamail to read out the mails while i open my any email account while i working on the net .
    actually what i want is whenever i open my account my program could detect the mail and it will it work after that
    so can anyone please help me out in doing this means my first problem is how to get my program get linked with that so that everytime i opem my email account (not specific) i can use the message stuff written in that for my further use
    please help me guys i really need help
    please reply as soon as possible
    thanks

    i could not understand your problem exactly.
    if you mean you want to check the new messages count: you can simply used
    int newMessages = folder.getNewMessageCount();if you are reading mails first time using javamail.
    see http://itoday.wordpress.com/2007/04/08/sending-mail-using-javamail-apis/
    if you mean something else ... please let me know
    asif shahzad
    Edited by: asifsh7 on Jul 22, 2008 8:53 AM

  • X.400 instead of SMTP Protocol and Javamail API

    We have developed a workflow application on Domino 5.0.7. The SmartHost is "MS Exchange Server", because the application will only be accessed by browsers, we are using javaagent to send the email notifications. Due to some domain restrictions on MS Exhchange servers we have implemented Javamail API on the domino server, and it worked fine (I mean the messages were received by the Exchange Clients, using the SMTP addresses like [email protected]). As we dont have available SMTP addresses for all end users in the company we need to use the X.400 addresses. Is there anyone, can help guide about either the avaiability of any X.400 javamail api, or how to use mapi etc? I know it is little bit challenging, but we are struck. thanks

    Currently, the latest version of the JavaMail 1.2 API, X.400 transport protocol is not supported yet. Only the transport SMTP - a message Transport protocol, for sending messages to a server, is supported.
    Allen Lai
    SUN Developer Technical Support

  • Send email using JavaMail

    hi every body,
    i am newbie in JavaMail API
    my question is : can i send an email to an yahoo or hortmail account.
    if yes, how can i do it ?
    thanks

    Yes, you can do it.
    You need a mail server, either your own, or one owned by your
    company, or one owned by your ISP, or a public mail server on
    which you have an account.
    The JavaMail FAQ has the rest of the information.

  • Plz help on javamail api (mayagiri)

    Can you tell me that, where can i find the history of javamail api
    like,
    who developed it, what is the motivation behind it?
    why the technology was developed.
    I am student , now persuing masters in IT.
    if possible plz mail me at [email protected]

    Hi Anand,
    This forum is exclusively for discussions related to Sun Java Studio Creator.
    For information related to Javamail please visit:
    http://java.sun.com/products/javamail/
    There is also a forum for questions related to Javamail. The URL to the forum is:
    http://forum.java.sun.com/forum.jspa?forumID=43
    Cheers
    Giri :-)
    Creator Team

  • Send email without opening mail app

    Hi
    So how can I send email without opening mail app.
    From: Overview of requested additional functionality, Ayuba Audu
    Hi Peter,
    There are a couple of services available that support sending emails via REST API calls. Of course, each such service requires a WADL connector to be created, but by taking advantage of resources such as the early alpha of our
    WADL Generator, along with
    our documentation, one will be enabled to do this.
    This way you do not need to have the Mail application available, on the machine the app is running on.
    Thanks.
    Hi Ayuba
    I guess the comment above was mentioned for this thread. If so can you please share a simple example file here or anywhere elese?
    Thanks

    Basically all I'm trying to do is to build an app for multiple users in one company. Each employer (user) is stored in collection with their password and email address. To get access to man screen of the app, employee must login in login screen. Chose his
    name and type the password. I want to add a button for forgotten password so in case one of the employee would forget his password he can click on the button and receive on his email his password. The email what he will get would be for example from
    [email protected] with mail body : your password is 12345.
    So is that what you meant I can do with WADL generator?

  • History of javamail api

    Dear,
    I am a student of masters in IT.
    Now i need some details of JavaMail Api
    i.e. when it is developed, why it is developed
    what is the motivation and mainly who is the person
    who took it seriousness to develop it?
    if possible please mail me to this id
    [email protected]
    waiting for ur reply.
    And give a good web reference so i can see the history for developing the JavaMail API.
    regards
    Anand S D

    duplicate? This is still not a Java forum. Messaging Server

  • JavaMail API(urgent)

    Hello
    can anyone tell me how can i get the list of emails in the inbox folder using javamail api, any idea exmple

    import java.io.*;
    import java.util.*;
    import javax.mail.*;
    import javax.mail.internet.*;
    public class ImapList {
    private static java.text.NumberFormat nf0=new
    java.text.DecimalFormat("0000");
    private static java.text.NumberFormat nf1=new
    java.text.DecimalFormat("0000000");
    private static String sf00="yyyy/MM/dd hh:mm";
    private static String sf01=" ";
    private static java.text.DateFormat df0=new
    java.text.SimpleDateFormat(sf00);
    private static String dumpDate(Date d) {
    if (d==null) return sf01;
    return df0.format(d);
    private String host;
    private String user;
    private String password;
    private static void usage() {
    System.err.println("Usage: " + ImapList.class.getName() + " imap_host_name user_name password");
    public ImapList(String host_,String user_,String password_)
    throws Exception {
    host=host_;
    user=user_;
    password=password_;
    public Message[] getList()
    throws Exception {
    Properties props=new Properties(System.getProperties());
    props.put("mail.store.protocol","imap");
    Session sess=Session.getDefaultInstance (props,null);
    Store store=sess.getStore();
    store.connect(host,user,password) ;
    Folder folder=store.getDefaultFolder();
    Folder f1=folder.getFolder("INBOX");
    f1.open(Folder.READ_ONLY);
    Message[] ret=f1.getMessages();
    //f1.close(false); //WOULD BE AN ERROR TO CLOSE!!
    return ret;
    public static void main(String argv[]) {
    try { main0(argv); }
    catch (Exception e) { usage(); e.printStackTrace(); }
    private static void main0(String argv[])
    throws Exception {
    ImapList il=new ImapList(argv[0],argv[1],argv[2]);
    Message[] mess=il.getList();
    int index=-1;
    try {
    index=Integer.parseInt(argv[3]);
    Message m=mess[index];
    new MessageDumper(m).dumpAll();
    return;
    catch (Exception e) {
    // e.printStackTrace();
    for(int i=0;i<mess.length;i++) {
    Message m=mess[ i ];
    Date d0=m.getSentDate();
    System.out.print(nf0.format(i) + " " + dumpDate(d0));
    Address[] from=m.getFrom();
    if (from == null) System.out.print(" NULLFROM");
    else for(int j=0;j<from.length;j++) System.out.print(" " + from[j]);
    System.out.println("");
    System.out.println(sf01+m.getSubject());
    }

  • JavaMail API + JMF ins it possible?

    Hello all,
    how is it possible to send captured and saved video files from within JMF desktop application .I'm not familiar with JavaMail API
    so please give some hint to do it..
    Thanks

    Your question doesn't make any sense.
    Try asking it again without mentioning "JavaMail" at all. and expand on exactly what it is you're trying to do...

  • JavaMail Api & SMTP server

    I'am trying to send an e_mail to myself using the javaMail API.
    I have already installed it (and also the Java Activation Framework).
    The code is:
    import javax.mail.*;
    import javax.mail.internet.*;
    import java.util.Properties;
    import java.util.Date;
    import java.io.*;
    public class PruebaMail {
    public static void main(String[] argv) {
              try {
                   Properties props = new Properties();
                   Session sendMailSession;
                   Store store;
                   Transport transport;
                   sendMailSession = Session.getInstance(props, null);
                   props.put("mail.smtp.host", "SMTP.mail.yahoo.com");
                   Message newMessage = new MimeMessage(sendMailSession);
                   newMessage.setFrom(new InternetAddress("[email protected]"));
                   newMessage.setRecipient(Message.RecipientType.TO, new InternetAddress("[email protected]"));
                   newMessage.setSubject("Prueba 1234");
                   newMessage.setSentDate(new Date());
                   newMessage.setText("Le escribimos para informarle que alguien ha respondido a su consulta");
                   transport = sendMailSession.getTransport("smtp");
                   transport.send(newMessage);
              } catch (MessagingException e1) {
              System.out.println("PruebaMail MessagingException:" + e1.getMessage());
    .. but, issuing C:\>java PruebaMail .. I get this error:
    PruebaMail MessagingException:Sending failed;
    nested exception is:
         javax.mail.MessagingException: Unknown SMTP host: SMTP.mail.yahoo.com;
    nested exception is:
         java.net.UnknownHostException: SMTP.mail.yahoo.com
    so, my question is:
    1. Is something wrong in my code. Do you know an available SMTP server which
    allows relaying??
    thanks in advance!

    You can find a SMTP Mailer Component that will easily send email messages, including attachments, at http://www.codecadet.com/components/ComponentDetail.aspx?ComponentID=ei47v8RePm0=. This component provides an easy to use interface/wrapper to the Java Mail API. Souce code and documentation is included.

Maybe you are looking for