Latest Tutorials| Questions and Answers|Ask Questions?|Site Map




Have Programming Question? Ask it here!
 
 
 


gautamshetkar
mail problem
0 Answer(s)      3 years and 2 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

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.


Advertisement
View Answers

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
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
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
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
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
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
php mail
php mail  how to send the submitted form to mail after 24 hours? pls help me
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 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
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...("mail.smtp.host", mailServer); // Get a mail session Session session = Session.getDefaultInstance(props, null); // Define a new mail message Message
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  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
(); out.println("Thanks for sending mail!"); } catch(Exception e
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 - 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
mail with multiple attachments
mail with multiple attachments  code for sending mail with multiple attachments in jsp
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 - 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
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
An E-mail protocol for storage
An E-mail protocol for storage  An E-mail protocol for storage, management and change, espically in corporate offices- a) Message handlindling services, b) Postal Service's, C) Data Storage, D)All of the above, e) None
Java Mail - JavaMail
Java Mail  how to email using Java mail or automatic generated mail???  Hi Friend, Please visit the following link: http://www.roseindia.net/javamail/ Hope that it will be helpful for you. Thanks
TEST JAMES MAIL SERVER
TEST JAMES MAIL SERVER  How to test Apache James Mail Server for stress? Which Load Generator should we use to create requests in the form of mail at a controlled rate for SMTP and POP3? Actually I needed to test JVM of the mail
java mail - Java Beginners
java mail  how to send mail using with out Authentication?????????/ using gmail server
java mail error - JavaMail
java mail error  how to rceive emails using java mail api  Hi Friend, We can use Java Mail APIs to send and receive mails in Java.... Please visit the following link to know more about use of Java Mail API. http
sending mail - JSP-Servlet
sending mail  Hi, what is the code for sending mail automatically without user intervention? thanks in advance
Java Mail API - JavaMail
Java Mail API  Hi! I wish u advanced happy new year to all of ur... account using java mail api... i got code from our roseindia.net i.e.... exception... Please solve my problem... Thanks in advance... Exception
Logos on mail inbox.
Logos on mail inbox.  What is the use of word "GOOGLE" , placed in the left corner of mail in box. Is there any functionality included to the word. It is showing some action when we are clicking the word, can u please explain
sending mail using jsp
sending mail using jsp  please give me the detailed procedure and code for sending mail through jsp program   Please visit the following links: http://www.roseindia.net/ejb/introduction/j2eedemo.shtml http
mail api - Development process
mail api  hi to all, it,s abhishek................. actually i am using mail api for sending the mail with attachments(audio and video... that the person which receive this mail and when download attachments(video
sent mail code - JavaMail
sent mail code  hi i have done a project in my final year.acually... a folder like SENT MAILS.so i need a sugestte code to that.pls send to my mail... . This link contains examples over the Java Mail API.. http://www.roseindia.net
Email - Electronic mail
Email - Electronic mail In this article we will understand the E-mail and see... internet users. We prefer email over standard mail. Email is free... is preferred over standard email because it is delivered instantly. E-mail is used
java mail - JavaMail
java mail  how to send a mail without authentication in java ?  Hi Friend, Please visit the following link: http://www.roseindia.net/javamail/ Hope that it will be helpful for you. Thanks
configure mail sever
configure mail sever  ok James is a best server for javamail but how to configure and run program if you have any program pls send me at upendra.softengg@gmail.com   Hi Friend, Read Here Thanks
recovery of password through mail
recovery of password through mail  hi i want code for login page authentication in jsp with oracle database.it should be similar to any mail login... to alternative mail id provided at the time of registration.plz.send the code soon
java mail sending with images
java mail sending with images  I need to send images through java mail without giving content path(i.e. we don't want hard code the image path)can you tell me the idea?   Please visit the following links: http
sending a mail - JSP-Servlet
sending a mail   I m writing a code for send mail in jsp,i sending a mail to specified receiver but if i attach an file and send a mail then i m getting an error. Here Attachment is in String[] Attachment=null so how
E-Mail header extractor
E-Mail header extractor  i want to extract email header with using of java so please show the code of email extractor as result all the field show different color and or it extract ip where the email came
E-Mail header extractor
E-Mail header extractor  i want to extract email header with using of java so please show the code of email extractor as result all the field show different color and or it extract ip where the email came
JAVA Mail - JavaMail
JAVA Mail  Hi! I am trying to send the mail using SMTP of gmail. program was compiled successfully. when i am trying to execute that program it is showing error --- Must issue STARTTLS command first... How to avoid
 

 

 

DMCA.com