mail problem


mail problem

mail problem
1 Answer(s)      6 years and 11 months ago
Posted in : JSP-Servlet

Sir, I tried ur send mail example but it giveng follwing error "Could not connect to SMTP host: localhost, port: 25" ,tried sendind from my gmail ac to rediffmail ac


        <title>Mail API</title>
    <body><table border="1" width="50%"  cellpadding="0" cellspacing="0">
                <td width="100%">
                    <form method="POST" action="mail.jsp">
                        <table border="1" width="100%" cellpadding="0" cellspacing="0">
                            <h1>Mail API</h1>
                                <td width="50%"><b>To:</b></td>
                                <td width="50%"><input type="text" name="to" size="30"></td>
                                <td width="50%"><b>From:</b></td>
                                <td width="50%"><input type="text" name="from" size="30"></td>
                                <td width="50%"><b>Subject:</b></td>
                                <td width="50%"><input type="text" name="subject" size="30"></td>          </tr>          <tr>
                                <td width="50%"><b>Description:</b></td>
                                <td width="50%"><textarea name="description" type="text"     cols="40" rows="15" size=100>      </textarea>
                                </td>          </tr>          <tr>
                                <td><p><input type="submit" value="Send Mail" name="sendMail"></td>
                    </form>  </td>


try{  Session mailSession = Session.getInstance(System.getProperties());
Transport transport = new SMTPTransport(mailSession,new URLName("localhost"));
  MimeMessage m = new MimeMessage(mailSession);
  m.setFrom(new InternetAddress(%><%request.getParameter("from")%><%));
  Address[] toAddr = new InternetAddress[] {
                 new InternetAddress(%><%request.getParameter("to")%><%)
                              m.setRecipients(javax.mail.Message.RecipientType.TO, toAddr );
                               m.setSentDate(new java.util.Date());
                               m.setContent(%><%request.getParameter("description")%><%, "text/plain");
                                 out.println("Thanks for sending mail!");
catch(Exception e){

Please help Thanks.

View Answers

October 6, 2015 at 4:24 AM

One fine day, Jack decided to complete his summer vacation assignment, to draw the view of the city which he gets from his room?s window. He tried so many times but he was not able to differentiate between the buildings. So he decided to ask you to make a program which will give him the horizon [an outline of land and buildings defined against the sky] coordinates of the city. Suppose there are N rectangular buildings in a 2-dimensional city and your computer program will compute the horizon of these buildings, eliminating hidden lines. His main purpose behind this is to view the buildings from a side and remove all sections that are not visible. Considering city to be in plain land and all buildings share common ground. Every building is represented by triplet (Length, height, breath). ?Length: is x coordinate of left side (or wall). ?Height: is height of building. ?Breath: is x coordinate of right side Consider building illustrated below is represented as (1, 11, 5) i.e. Length = 1, Height = 11 and Breadth= 5.send me the code for this in java language.


Related Tutorials/Questions & Answers:
mail problem
mail problem  Sir, I tried ur send mail example but it giveng...; <title>Mail API</title> </head> <body><table...;Mail API</h1> <tr>
iphone mail sending problem
iphone mail sending problem  Hi, I'm receiving the following error ... while sending mail in my iphone application Terminating app due to uncaught... it done myself... actually in my send mail code i have predefined the mailto id
send the mail with attachment problem - Struts
send the mail with attachment problem  Hi friends, i am using the below code now .Here filename has given directly so i don't want that way. i need... mail server properties.setProperty("", host
problem in viewing the mail's content using javamail
problem in viewing the mail's content using javamail  i'm using the following code to view a mail in a javamail application problem i'm facing... as if they are body of the mail. Secondly in some mails i'm getting the following Exception
mail  I wrote a program to send mail using smtp. But there is an error message " could not connect to port 465. what is the problem how can i solve it ...   Please visit the following link: Java Mail API
problem in getting mail exchange records(MX) using DNS (glassfish(struts2))
problem in getting mail exchange records(MX) using DNS (glassfish(struts2))  Hi, dummy.jsp <%@page import="javax.naming.Context"%> <%@page import="java.util.Hashtable"%> <%@page import
problem in getting mail exchange records(MX) using DNS in java
problem in getting mail exchange records(MX) using DNS in java  Hi, jsp file: <%@page import="javax.naming.NamingEnumeration"%> <%@page import="javax.naming.Context"%> <%@page import="java.util.Hashtable
mail  how to send mail using jsp   Please visit the following links: JSP Send Mail Java Mail Tutorials
java mail programs
java mail programs  I got some codes from this about sending mail,forwarding mail,multipart mail etc..and I compiled and executed it,but it did... output.actually,do I need a mail server to get correct output of these codes?plz help me, I
java mail api - JavaMail
java mail api  Hi, Pls give me the detailed information on how... in the code..   Hi friend, For solving the problem remember some points : 1.Download the Apache Mail server (James)
java mail
java mail  By Which code or function i can send E-mail to given E-mail Address   Hi Friend, Please visit the following link: Java Mail Thanks   Hi Friend, Please visit the following link: Java Mail
java mail
java mail example  how to download javamail software give one examples   Please visit the following link: Java Mail API
php mail
php mail  how to send the submitted form to mail after 24 hours? pls help me
send the mail with attachment - Struts
the mail . Mail Problem is file path: how to get the file path from the browse("we...send the mail with attachment   Hi Freinds, i am sending the mail without attachment file now. But i need to send the mail with attachment
Confirmation Mail
Confirmation Mail  hi, i need the code.when we sign up it will send the confirmation mail to the e-mail to do that part.....and also help me whether the AJAX is better or PHP better for the front design
java mail
java mail  how to download javamail software give one examples   Please visit the following link: Java Mail API
java mail
Mail API is now open source and you can download the source code and read. If you want to understand the working of Java Mail download the source code from here and learn the coding logic behind Java Mail. You can even compile the source code
java mail
) throws MessagingException, AddressException { // Setup mail...("", mailServer); // Get a mail session Session session = Session.getDefaultInstance(props, null); // Define a new mail message Message
java mail - Java Beginners
java mail  how to send a mail without authentication one domain to another in java?  hi elumalai, check yourself, this is user problem.  Hi, You have to use the Java mail api. You need to use the SMTP
Java Mail exception - JavaMail
Java Mail exception  Hi! I am developing E-mail Client (GMAIL) program using JSP technology. Till now i dont have any problem. From last 3 days while i am connecting to the Gmail, I am getting the following exception... Whats
java mail
java mail  Hi deepak, sorry to trouble again but with reference to apache mail server (james) tutorial i use the link that u have provided it redirects to apache offical site what there 4 zip and taz
JAVA MAIL - JavaMail
JAVA MAIL  Hi! I am doing project called "E-mail Client". In this i want to view attachments which are in my mail in my application. I have tried... cannot be applied to multipart... how to get my mail attachments in my
Version of gj-mail>gj-mail dependency
List of Version of gj-mail>gj-mail dependency
java mail
(); out.println("Thanks for sending mail!"); } catch(Exception e
mail with multiple attachments
mail with multiple attachments  code for sending mail with multiple attachments in jsp
Java Mail - JMS
, For solving the problem visit to : running very well,creating no other problems. Now i am trying to learn java mail service. I hav written a sample mail program to just test the code.The code
Compose mail by clicking on send mail button
Compose mail by clicking on send mail button  How i get microsof out look page opend for composing mail by just clicking on send mail button and when outlook page open then in to:my email id is written on my jsp page
configure mail sever
configure mail sever  which is the best server for java mail?   Hi, James is the best mail server in Java. You can download the James for free. Read more at Apache Mail server. Thanks
Java Mail API Tutorial
Java Mail API Tutorial  I have to write programs using the Java Mail API. I want to learn the Java Mail API. Let's know the urls to learn Java Mail... Mail API. The Java Mail API allows you to send, read emails from Java program
php send mail with attachment
php send mail with attachment  Syntax of sending email with attachment in PHP
send mail in PHP
send mail in PHP  what are configurations needed to send mail in php.ini file by localhost ,please give me complete details about this,and code in datail