How can Send Email From JSP to all Mail server.it gives error
I try this code in netbean 5.But it will give the Error.
The code:
<%@page import="java.util.*"%>
<%@page import="javax.mail.*"%>
<%@page import="javax.mail.internet.*"%>
<%
Properties props = System.getProperties();
props.put("mail.smtp.host", "smtp.gmail.com" );
props.put("mail.smtp.port", "465" );
Session s = Session.getInstance(props, null);
MimeMessage message = new MimeMessage(s);
String From = request.getParameter("sender");
InternetAddress from = new InternetAddress(From);
message.setFrom(from);
String Tos = request.getParameter("reciever");
InternetAddress to = new InternetAddress(Tos);
message.addRecipient(Message.RecipientType.TO, to);
String sub =request.getParameter("subject");
message.setSubject(sub);
String mgs =request.getParameter("message");
message.setText(mgs);
Transport.send(message);
%>
<html>
<p align="center">
A Message has been sent. <br>
Check your inbox.
</p>
<p align="center">
Click here to send another!
</p>
</html>
Error is :
javax.servlet.ServletException: Could not connect to SMTP host: smtp.gmail.com, port: 465
org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextImpl.java:848)
org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:781)
org.apache.jsp.MailBeema_jsp._jspService(MailBeema_jsp.java:88)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:322)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:291)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:241)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
org.netbeans.modules.web.monitor.server.MonitorFilter.doFilter(MonitorFilter.java:362)
root cause
javax.mail.MessagingException: Could not connect to SMTP host: smtp.gmail.com, port: 465;
nested exception is:
java.net.ConnectException: Connection timed out: connect
com.sun.mail.smtp.SMTPTransport.openServer(SMTPTransport.java:1282)
com.sun.mail.smtp.SMTPTransport.protocolConnect(SMTPTransport.java:370)
javax.mail.Service.connect(Service.java:275)
javax.mail.Service.connect(Service.java:156)
javax.mail.Service.connect(Service.java:105)
javax.mail.Transport.send0(Transport.java:168)
javax.mail.Transport.send(Transport.java:98)
org.apache.jsp.MailBeema_jsp._jspService(MailBeema_jsp.java:68)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:322)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:291)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:241)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
org.netbeans.modules.web.monitor.server.MonitorFilter.doFilter(MonitorFilter.java:362)
javax.mail.MessagingException: Could not connect to SMTP host: smtp.gmail.com, port: 465;
nested exception is:
java.net.ConnectException: Connection timed out: connectFairly self-explaining, isn't it? That host cannot be connected.
Either check the correctness of the hostname/port, or check your network settings (firewall, router, etc).
Similar Messages
-
How do I get my list of contacts from Gmail to my iPad2 so I can send email from the iPad?
Take a look at this help site that I found by using Google ...
http://support.google.com/mobile/bin/answer.py?hl=en&answer=138740 -
For some reason I cannot send email - all was working fine, but now I get the following error message when I try to send email:
'The sender address (my email address) was rejected by the server smtp.tiscali.co.uk'
I can receive incoming mail ok and I can send email from other Apple devices. The problem seems confined to my Mac Book Pro.
Ant ideas?Hello there, Pablo639.
The following Knowledge Base article offers up some great steps for troubleshooting mail issues on your Mac:
OS X Mail: Troubleshooting sending and receiving email messages
http://support.apple.com/kb/TS3276
Thanks for reaching out to Apple Support Communities.
Cheers,
Pedro. -
I can receive emails, but I cannot send emails. This just started happening. I have an iPhone and I can send emails from my phone fine. It's just not working on my Macbook. Every time I try to send an email it goes straight to my outbox. Can anyone help?
Thank you for heading me in the right direction. I reset my Mail account for Outgoing Mail Server to outbound.att.net:(customer ID)@att.net (instead of smtp.att.yahoo.com, per Apple's online troubleshooting information). I'm not sure what "(Offline)" means when it appears at the end of my Outgoing Mail Server (SMTP)?? In the Advanced box I clicked on "Use custom port: 465" and checked "Use Secure Sockets Layer." Authentication: Password; I have correct User Name and Password put in. After doing all this, when I try to send emails again today, they go directly to the Outbox and sit there.
What's curious is that my first sent email this morning did go out using the Outgoing Mail Server, smtp.att.yahoo.com: (customer ID)@att.net(Offline) but subsequent emails I tried to send with this server were rejected with the message: "Cannot send message using the server smtp.att.yahoo.com (etc.). The SMTP server doesn't support TLS(SSL) on port 587. Verify your account settings and try again." That's when I tried resetting my Outgoing Mail Server to outbound.att.net (etc.), as mentioned above, and was unsuccessful in sending out any further emails. I guess my next step is to contact my email service provider, AT&T, and see if they can help me. Thanks, again, for taking the time to respond and for giving me your input! Much appreciated! -
I cannot connect to my outgoing email server on my macBook pro, yet I can, for the same email account on my iPad. Also I can send emails from the other email account I have on my MacBook...really confused can anyone help?
Sometimes deleting the account and then re-creating it can solve this issue
Write down all the information in accounts before doing this
Highlight the account on the left and click the minus button
Then click the plus button to add the new account and follow the prompts -
I want to send email from jsp,
i want to send email from jsp, i dont know smtp:host, how to send mail?
plz carify this doubt sir.OK thanks sir but i installed alredy. i write this code. plz send any error's are there. and i dont know smtp:host name. i put my port address?
try{
//Set the host smtp address
Properties props = new Properties();
props.put("mail.smtp.host", "//10/0/6/252");
// create some properties and get the default Session
Session session = Session.getDefaultInstance(props, null);
// create a message
Message msg = new MimeMessage(session);
// set the from and to address
msg.setFrom(new InternetAddress("[email protected]"));
msg.addRecipient(Message.RecipientType.To,new InternetAddress("[email protected]"));
// Setting the Subject and Content Type
msg.setSubject("hi..");
msg.setText("hi bharath how are you");
Transport.send(msg);
catch(Exception e)
out.println(e);
} -
how to send sms from jsp
First of all, you need to have the gsm modem or access to any Telco sms gateway.
If you don have any access to the Telco sms gateway, try to download the SMSLib-Java-v2.1.2 java library from the http://sourceforge.net/project/showfiles.php?group_id=164313.
Edit the example in the download file and include the example in your JSP file to send the sms using GSM modem. -
I have set up two email accounts on my iphone4, one with tiscali, my ISP, and the other on gmail. I am able to receive emails on both accounts, and can send emails from my gmail account, but am "Unable to Send Email" from my tiscali (talktalk) account. I get the error message "A copy has been placed in your Outbox. The sender address "name"@tiscali.co.uk was rejected by the server".
Hi apmichael,
If you are having issues sending email from one of your mail accounts on your iPhone, you may find the following article helpful:
iOS: Troubleshooting Mail
http://support.apple.com/kb/ts3899
Regards,
- Brenden -
Help! I can send emails from my ipad2 that contain text - but they're unable to send if I attach any pictures! So frustrating! I have an iPhone
I have an iPhone & can send pictures via email without issue but I can't on ipad2. Any ideas why?? Thx!
-
How to send emails from HANA SQL Console
Hi,
Please guide how to send mail from HANA Studio SQL Console.
Is there any standard procedure in Hana Studio to send Mail( e.g. in MS SQL "sp_send_dbmail" Procedure)Hi Preethi,
Please go through the attached link:
How to send emails from HANA
Regards,
Krishna -
How to send emails from of pdf's generated by oracle reports
I have several pdf documents , I want to email those pdf's . Please let me know how to send emails from oracle reports .
Thanks,
PrevinI have integrated Oracle Reports with Oracle Portal and used the scheduling feature via portlets. We have reports that run every monday morning for management. For more info go to:
http://otn.oracle.com/products/reports/htdocs/getstart/demonstrations/index.html
OR
I think if you set destype=mail, desformat=PDF, and desname=[email protected] that should also do the trick.
Just be sure that you have put your mail server's IP address in the rep_<machine_name>.conf file located in your <oracle_home>/reports/conf directory. If this is not set up, the mail feature won't work.
Martin -
How to sending email from Oracle Forms
How to sending email from Oracle 6i(Forms)
I need to send email to a distribution list(multiple email addresses).send email of multiple email address
[email protected],[email protected],[email protected]
create or replace function mailout
(sender in varchar2,
recipient in varchar2,
ccrecipient in varchar2,
subject in varchar2,
message in varchar2) return number
is
crlf varchar2(2) := chr(13)||chr(10);
connection utl_smtp.connection;
mailhost varchar2(50) := 'Add email server Ip Address here';
header varchar2(4000);
v_num number :=1;
str number:=0;
email varchar2(50);
begin
connection := utl_smtp.open_connection(mailhost,25);
header := 'Date: '||to_char(sysdate,'dd mon yy hh24:mi:ss')||crlf||
'From: '||sender||' '||crlf||
'Subject: '||subject||crlf||
'To: '||recipient||crlf||
'Cc: '||ccrecipient||crlf||message;
utl_smtp.helo(connection,mailhost);
utl_smtp.mail(connection,sender);
utl_smtp.rcpt(connection,recipient);
while (instr(ccrecipient,',',1,v_num)>0) loop
email:=substr(ccrecipient,str+1,instr(ccrecipient,',',1,v_num)-str-1);
dbms_output.put_line(email);
utl_smtp.rcpt(connection,email);
str:=instr(ccrecipient,',',1,v_num);
v_num:=v_num+1;
end loop;
utl_smtp.open_data(connection);
-- utl_smtp.write_data(connection,header);
utl_smtp.write_data(connection,'MIME-Version:1.0'||crlf||'Content-type:text/html'||crlf||header);
utl_smtp.close_data(connection);
utl_smtp.quit(connection);
return 0;
exception
when utl_smtp.invalid_operation then
dbms_output.put_line('Invalid Operation in SMTP transaction');
return 1;
when utl_smtp.transient_error then
dbms_output.put_line('Temporary problem with sending email ');
return 2;
when utl_smtp.permanent_error then
dbms_output.put_line('Permanent problem with sending email ');
return 3;
end; -
Send email from OWB with authenticated SMTP server (AUTH_LOGIN)
Hi all,
I want to send email from Oracle Warehouse Builder 11.2.0.2 using a SMTP server with basic authentication (AUTH_LOGIN).
I've created an ACL for OWBSYS user according to note ID 1229769.1 in support.oracle.com.
But, I need to configure again the ACL to connect to the SMTP server using user and password.
I read the article in metalink, *How to Send an Email Using SMTP over an SSL Connection [ID 1323140.1]*+
but I don't know how can I configure again the ACL for use in OWB.
How OWB is able to authenticate with the SMTP server?
Thanks!
Maximiliano.Duplicate -
How to send email from OSB with Mail server that requires SSL or STARTTLS
Regards,
Anuj -
How to send emails using JSP?
How can i send emails using JSP? what are the things that i will need? please help me asap...thanks
Hi,
This works for me:
<%
String from = "Person"
String to= "my-email-address;
try{
SmtpClient client = new SmtpClient("smtp.stuff.com");
client.from(from);
client.to(to);
PrintStream message = client.startMessage();
message.println("To: " + to);
message.println("Subject: Sending an e-mail");
message.println();
message.println("Groovy :-)");
client.closeServer();
catch (IOException e){
System.out.println("ERROR SENDING EMAIL: "+e);
%> -
How to send SMS from JSP application.
Hi,
I have created a web application using JSP for our Office internal use. I want to include the folowing option in our app.
1) How to send SMS from the application to mobile.
2) I don't want to use third party service (ex: SimpleWire). as the app is for internal purpose only.
It will be helpful, if I get the complete procedure to implement it, as this is my first application.
Thanks & Regards
suresh.I am having problem with smslib. smslib is an enhanced version of jsmengine, I have compiled the program, there is no error but when I run it , the following error is found. Can you help? my email is [email protected]
Exception in thread "main" java.lang.NoClassDefFoundError: CIncomingMessage (wrong name: org/smslib/CIn
comingMessage)
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:620)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:124)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:260)
at java.net.URLClassLoader.access$100(URLClassLoader.java:56)
at java.net.URLClassLoader$1.run(URLClassLoader.java:195)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:268)
at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319)
Maybe you are looking for
-
Dear All, I have a report as follows: >>PO PO Item GRN GRN Item PO Qty GRN Qty >>4700 10 5000 1 100 25 >>4700 10 5001 1 100
-
How do I run system recovery dvd from an external dvd drive?
I am having trouble trying to restore my DV 6000 (dv6915nr) from an external dvd drive. I am aware that this laptop has had several hardware issues, including the loss of use of the internal dvd drive and have tried all the fixes that I could find,i
-
Adobe Acrobat 8 pro updates step by step?
Is that the truth?! I installed Adobe Acrobat 8 pro at my new bussiness machine (Win7ultimate32bit) and I have to load every f... update one by one and to install every update one by one and to restart the machine recently? Or I'am blind and can't fi
-
Thai font is not showing in the PDF report
Hi Gurus I m generating report in PDF format. I want some fields should be in Thai language which r in thai language in the database. But my PDF report cannot show this. Its showing some gurbage data. Mokarem
-
Error CK048 in Production order Create ( CO01 )
Hi all. Good New Year. I've deleted some costs elements in 01012009. But in transaction CO01, The system displays the error CK048 saying that "NO COST ELEMENT SEGMENT EXISTS FOR THE DATE" . In the OKB9 and KAH3 I haven't relation with the cost elemen