Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Java > Java and JDK > Pro JSP
|
Pro JSP Advanced JSP coding questions. Beginning questions will be redirected to the Beginning JSP forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Pro JSP section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old December 11th, 2006, 04:06 AM
Registered User
 
Join Date: Dec 2006
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default Problem In Sending mails

hello friends...
m deepak...
workin on javamail...
m unable to send mails using the javamail....
m using the following code...:

<%@ page import="java.util.Properties"%>
<%@ page import="javax.mail.*" %>



<html>
</body>

<%
String host = "hostname";
String username = "username";
String password = "password";

String Prolocol="IMAP";

    // Create empty properties
Properties props = new Properties();

    // Setup mail server
    props.put("mail.smtp.host", host);

    // Get session
    Session mysession = Session.getDefaultInstance(props, null);

    Store store = mysession.getStore("imap");
    store.connect(host, username, password);

    // Define message
    MimeMessage message = new MimeMessage(mysession);

    // Set the from address
    message.setFrom(new InternetAddress(from));

    // Set the to address
    message.addRecipient(Message.RecipientType.TO,
      new InternetAddress(to));

    // Set the subject
    message.setSubject("Hello JavaMail");

    // Set the content
    message.setText("Welcome to JavaMail");

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


%>


</body>
</html>

can u help me out...







Similar Threads
Thread Thread Starter Forum Replies Last Post
sending e-mails How To?? saudyonline General .NET 13 November 17th, 2006 01:00 AM
Sending mails. rupen Javascript How-To 1 October 25th, 2005 07:22 AM
Sending e-mails using C# lily611 General .NET 3 June 30th, 2004 05:46 AM
Problem witht Sending e-mails mahulda ASP.NET 1.0 and 1.1 Basics 1 April 26th, 2004 09:07 PM
Sending mails rajeshnerenki Pro VB 6 4 September 25th, 2003 03:34 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.