Results 1 to 2 of 2
  1. #1
    jay8186 is offline Member
    Join Date
    Mar 2009
    Rep Power

    Exclamation Facing problem while sending e-mail

    my code runs on a windows server on my machine but as i upload the same class file to the linux machine it does not work.

    As there is no error generation go cant get the exact problem..

    See my code below if u could help me...

    public static String myemail = "", //username
    mypassword = "*************", //password
    myhost = "", // smtp address
    myport = "234", // port address
    mysubject = "Hello",
    mytext = "this is just a test mail";

    public String mail(String recp)

    Properties pro = new Properties();
    pro.put("mail.smtp.user", myemail);
    pro.put("", myhost);
    pro.put("mail.smtp.port", myport);
    pro.put("mail.smtp.auth", "true");
    pro.put("mail.smtp.debug", "true");

    SecurityManager security = System.getSecurityManager();

    Authenticator authen = new SMTPConfig();
    Session session = Session.getInstance(pro, authen);

    MimeMessage msg = new MimeMessage(session);
    msg.setFrom(new InternetAddress(myemail));
    msg.addRecipient(Message.RecipientType.TO, new

    catch (Exception ex)

    return null;


    private class SMTPConfig extends javax.mail.Authenticator

    public PasswordAuthentication getPasswordAuthentication()
    return new PasswordAuthentication(myemail, mypassword);


  2. #2
    khadaree is offline Member
    Join Date
    Mar 2009
    Rep Power

    Default hi

    That might be because of your anti virus settings. But i am not sure. I have also faced the same problem. Ask your network admin about this. In anti virus settings it blocks the bulk sending of messages. disable that and check it. You might solve the problem.

Similar Threads

  1. Sending a Mail
    By haiforhussain in forum Advanced Java
    Replies: 7
    Last Post: 07-30-2008, 12:28 AM
  2. Java mail problem Urgent
    By sundarjothi in forum Advanced Java
    Replies: 0
    Last Post: 06-02-2008, 11:34 AM
  3. Sending Mail Using Sockets
    By Java Tip in forum
    Replies: 0
    Last Post: 04-07-2008, 08:05 PM
  4. Sending a mail with the local mail program
    By thedude in forum Advanced Java
    Replies: 2
    Last Post: 07-23-2007, 12:19 PM
  5. Sending mail Using JAVAMAIL
    By peiceonly in forum Advanced Java
    Replies: 3
    Last Post: 07-19-2007, 02:11 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts