Java Forums

Main Menu
Home
Today's Posts
FAQ
Search
Contact Us

Java Network
Java Tips
Java Tips Blog

Sponsored Links





Welcome to the Java Forums.

You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community, you will:

  • have access to post topics
  • communicate privately with other members (PM)
  • not see advertisements between posts
  • have the possibility to earn one of our surprises if you are an active member
  • access many other special features that will be introduced later.

Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact us.

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 12-27-2007, 01:00 AM
Member
 
Join Date: Dec 2007
Posts: 1
profuse is on a distinguished road
JSP send mail script not working.
Hello,

my client have Java source at domain domain.com, 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 java.io.*;
import javax.mail.*;
import javax.mail.internet.*;
//import javax.activation.*;

import org.apache.commons.mail.DefaultAuthenticator;

// lib : activasion.jar
// mail.jar
// commons.email-1.0.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("mail.smtp.host", 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
InternetAddress(to));
msg.setSubject(subject);
msg.setText(content);

// Send the message
Transport.send(msg);
}

public static void main(String[] args) throws Exception {
// Send a test message
send("domain.com", 25, "user@domain.com",
"user@domain.com", "Subject:
TestSubject", "TestText");
System.out.println("finish");
}
}
================================================== ===============

Please provide solution if any ASAP.

Thank you.
Bookmark Post in Technorati
Reply With Quote
Sponsored Links
  #2 (permalink)  
Old 05-27-2008, 07:37 AM
Member
 
Join Date: Apr 2008
Location: villupuram
Posts: 20
sundarjothi is on a distinguished road
Send a message via AIM to sundarjothi
please mention your program exception or error.
Bookmark Post in Technorati
Reply With Quote
Sponsored Links
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
A Client to Send SMTP Mail Java Tip java.net 0 04-07-2008 09:06 PM
Retreiving of mail body using mail number chandu.v09 JavaServer Pages (JSP) and JSTL 0 03-13-2008 03:25 PM
Sample ANT Script Java Tip Java Tips 0 01-24-2008 04:22 PM
Send a pic through mail, in java lenny Advanced Java 1 07-25-2007 03:49 PM
Sending a mail with the local mail program thedude Advanced Java 2 07-23-2007 01:19 PM


All times are GMT +3. The time now is 10:40 AM.


VBulletin, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright ©2006 - 2007, www.java-forums.org