mail problem

mail problem

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

mailapi

<html>
    <head>
        <title>Mail API</title>
    </head>
    <body><table border="1" width="50%"  cellpadding="0" cellspacing="0">
            <tr>
                <td width="100%">
                    <form method="POST" action="mail.jsp">
                        <table border="1" width="100%" cellpadding="0" cellspacing="0">
                            <h1>Mail API</h1>
                            <tr>
                                <td width="50%"><b>To:</b></td>
                                <td width="50%"><input type="text" name="to" size="30"></td>
                            </tr>
                            <tr>
                                <td width="50%"><b>From:</b></td>
                                <td width="50%"><input type="text" name="from" size="30"></td>
                            </tr>
                            <tr>
                                <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>
                            </tr>
                        </table>       
                    </form>  </td>
            </tr>
        </table>
    </body>
</html>

mail.jsp

<html>
    <head>
        <title>Mail</title>
    </head><body>
<%
try{  Session mailSession = Session.getInstance(System.getProperties());
Transport transport = new SMTPTransport(mailSession,new URLName("localhost"));
 transport.connect("localhost",25,null,null);
  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.setSubject(%><%request.getParameter("subject")%><%);
                               m.setSentDate(new java.util.Date());
                               m.setContent(%><%request.getParameter("description")%><%, "text/plain");
                                transport.sendMessage(m,m.getAllRecipients());
                                 transport.close();
                                 out.println("Thanks for sending mail!");
}
catch(Exception e){
     out.println(e.getMessage());
      e.printStackTrace();
}
                               %>
    </body>
</html>

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
Advertisements
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("mail.smtp.host", 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
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
mail  I wrote a program to send mail using smtp. But there is an error message " could not connect to smtp.gmail.com port 465. what is the problem how can i solve it ...   Please visit the following link: Java Mail API
mail
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) http://james.apache.org
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
java mail
java mail example  how to download javamail software give one examples   Please visit the following link: Java Mail API
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:ADS_TO_REPLACE_1 Java Mail Thanks   Hi Friend,ADS_TO_REPLACE_2 Please visit
php mail
php mail  how to send the submitted form to mail after 24 hours? pls help me
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
Confirmation Mail
Confirmation Mail  hi, i need the code.when we sign up it will send the confirmation mail to the e-mail right.how 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 - 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
problem getting password - JavaMail
problem getting password  hi i am trying to get password but igot following error Error sending mail:javax.mail.MessagingException: Could not connect to SMTP host: 192.168.10.14, port: 25;nested exception
problem in onlinetest...
problem in onlinetest...  hi, my code getting the problem is ,when user leave a question then the server puts error... pls help me
Version of gj-mail>gj-mail dependency
List of Version of gj-mail>gj-mail dependency
java mail
_TO_REPLACE_2   Hi, Java 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
problem running a servlet on tomcat.
problem running a servlet on tomcat.  i have followed the steps given..., the browser responds "HTTP Status 404 - /java_mail/hello" wht could be the problem? please help me out
Java Mail - JMS
, For solving the problem visit to : http://www.roseindia.net/mail/sending-an-email... 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
mail with multiple attachments
mail with multiple attachments  code for sending mail with multiple attachments in jsp
problem in validation
problem in validation  sir/madam, i m using struts-1.3.10. i m getting a problem my properties file is not found.... while i hav configuired it in struts-config.xml file, likeADS_TO_REPLACE_1 thanks n regards himanshu
javascript problem
javascript problem  hi guys My problem is that I am using radio button for yes or no but i want to do that if I press yes button then enter... enter please help me this problem
jdbc problem
jdbc problem   hi my name is mohit...i am making a project in java swings....pls help me how to check that the username and password are correct... values are not correct then the program ends...it just like yahoo mail , gmail
java mail
) throws MessagingException, AddressException { // Setup mail...("mail.smtp.host", mailServer); // Get a mail session Session session = Session.getDefaultInstance(props, null); // Define a new mail message Message
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
problem on strings
problem on strings  in string1 "123456 ABC DEF...",IN string2 "raveen". iwant to add string2 after 123456 in the first string based on index number.i need logic for this with out using StringBuffer concept. Thanks in advanace
Problem with loginbean.jsp
Problem with loginbean.jsp  http://www.roseindia.net/jsp/loginbean.shtml - I am getting an error in loginbean.jsp.There is some error regarding .What is hello in this? Also in this example how
compilation problem
compilation problem  struts 2.0 : i have included all 5 jars in lib folder,but its giving compilation problem that package open symphony doesnot... havenot set the build path.if this is the problem then tell me how to set
compilation problem
compilation problem  struts 2.0 : i have included all 5 jars in lib folder,but its giving compilation problem that package open symphony doesnot... havenot set the build path.if this is the problem then tell me how to set
Problem with cookies
Problem with cookies  Hello All, i need jsp code for RememberMe module of login. i am facing problem with cookies. so please if any one could guide me please help and provide mme the exact code.   Please visit
problem with package
problem with package  Dear sir, i have created one java file with package com.net; and i compiled the program.it showing the .class file in " net" folder.The problem is i want to use that .class file in some other
Oracle9i Problem
Oracle9i Problem  Hi I have a problem in Oracle9i .I have... the table what i created .But after closing the SQL+ ,the problem started.When i... .....;.it is saying no rows are selected.Why the problem arised in not getting the data that i
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
java mail
(); out.println("Thanks for sending mail!"); } catch(Exception e
problem with session.invalidate()
problem with session.invalidate()  i stuck by a line with "session.invalidate()", after user logout also by pressing the back button of the browser user is still able to navigate to his home page and able to view the session
JScrollBar Problem...
JScrollBar Problem...  Hello Sir/mam, Can i know how to use JScrollBar to JFrame without adding any JPanel to it.. i want to add JScrollBar Directly to JFrame... Please Provide me Simple Example so i can understand
problem on php
problem on php   l have five tables and build them as forms and link between them php and database and i want to build query between them plz help me soon   PHP MySQL Tutorials
URL problem
URL problem  Hi. I have created a webpage for my project website. in that i have used frameset to split the page. Now if i click any link in the page its navigating to the another page. but the problem is here in the url its
Is AI a problem?
Is AI a problem?  Hi, I am beginner in Data Science and machine learning field. I am searching for the tutorials to learn: Is AI a problem? Try... "Is AI a problem?". Also tell me which is the good training courses
Skyline Problem
is the line tracing the largest y value from any rectangle in S The Problem: Write.... Your method should solve the problem three different ways; each solution
Problem in Array
Problem in Array  Hi, Can you help me with this problem? Run a program that check if the input string contains equal number of A's and B's. Hoping for your answer.Thank you.   Here is an example that check
problem
Problem
Problem

Ads