Results 1 to 2 of 2
  1. #1
    profuse is offline Member
    Join Date
    Dec 2007
    Rep Power

    Default JSP send mail script not working.


    my client have Java source at domain, but till now
    can't send email

    On local pc the source running well but after upload to server, the
    source can't work

    sample source below please review the source

    If you have sample Java source that running well on your server please
    send to me

    Below is the script.
    ================================================== =============

    -------- Source java :
    package package;

    import javax.mail.*;
    import javax.mail.internet.*;
    //import javax.activation.*;

    import org.apache.commons.mail.DefaultAuthenticator;

    // lib : activasion.jar
    // mail.jar

    public class SendApp {
    public static void send(String smtpHost, int smtpPort, String from,
    String to, String subject, String content)
    throws AddressException,
    MessagingException {
    // Create a mail session
    java.util.Properties props = new java.util.Properties();
    props.put("", smtpHost);
    props.put("mail.smtp.port", "" + smtpPort);

    props.put("mail.smtp.auth", "true");
    props.put("mail.smtp.starttls.enable", "true");

    String user = "user";
    String pass = "";
    // password same with cpanel pass

    Authenticator auth = new DefaultAuthenticator(user, pass);
    Session session = Session.getDefaultInstance(props, auth);

    // Construct the message
    Message msg = new MimeMessage(session);
    msg.setFrom(new InternetAddress(from));
    msg.setRecipient(Message.RecipientType.TO, new

    // Send the message

    public static void main(String[] args) throws Exception {
    // Send a test message
    send("", 25, "",
    "", "Subject:
    TestSubject", "TestText");
    ================================================== ===============

    Please provide solution if any ASAP.

    Thank you.

  2. #2
    sundarjothi is offline Member
    Join Date
    Apr 2008
    Rep Power

Similar Threads

  1. A Client to Send SMTP Mail
    By Java Tip in forum
    Replies: 0
    Last Post: 04-07-2008, 08:06 PM
  2. Retreiving of mail body using mail number
    By chandu.v09 in forum JavaServer Pages (JSP) and JSTL
    Replies: 0
    Last Post: 03-13-2008, 02:25 PM
  3. Sample ANT Script
    By Java Tip in forum Java Tip
    Replies: 0
    Last Post: 01-24-2008, 03:22 PM
  4. Send a pic through mail, in java
    By lenny in forum Advanced Java
    Replies: 1
    Last Post: 07-25-2007, 02:49 PM
  5. Sending a mail with the local mail program
    By thedude in forum Advanced Java
    Replies: 2
    Last Post: 07-23-2007, 12:19 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