mail problem

Ads
 

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.

Ads









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
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
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
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
java mail example  how to download javamail software give one examples   Please visit the following link: Java Mail API
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
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
php mail
php mail  how to send the submitted form to mail after 24 hours? pls help me
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
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
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
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

Ads