MessagingException "Unknown SMTP host"
Hi
I am using JavaMail to send out emails from an ecommerce application. We are now deploying the application and are getting the following message....
nested exception is:
class javax.mail.MessagingException: Unknown SMTP host: smtp.thehost.com ;
nested exception is:
java.net.UnknownHostException: smtp.thehost.com
(note the server name is not actually smtp.thehost.com) - ive used that one here for confidentality.
If i try to telnet to smtp.thehost.com on port 25 i get the expected 220 and everything seems fine. Its like JavaMail cant see the mailhost when everything else can.
I am using :
Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.2_04-b05)
Java HotSpot(TM) Client VM (build 1.4.2_04-b05, mixed mode)
on Redhat.
Any suggestions?
Regards
Lawrence
If i try to telnet to smtp.thehost.com on port 25 i get the expected 220 and everything seems fine. Its like JavaMail cant see the mailhost when everything else can.This suggests that you aren't telling JavaMail the right host name. It looks to me as if it has an unnecessary space at the end, but at any rate check your code.
Similar Messages
-
Hello, javax.mail.MessagingException: Unknown SMTP host:
Hello,
I am trying to send a mail and use a smtp Server which is located on the internet. I am however behind a firewall and am getting the following exception being thrown:
javax.mail.MessagingException: Unknown SMTP host:
This implies that I need to provide some settings for my proxy server. I though to solve this problem I could do the following:
System.getProperties().put("proxySet", "true");
System.getProperties().put("http.proxyHost", proxyHost);
System.getProperties().put("http.proxyPort", proxyport);
This however does not solve me problem as I still get the above exception. Could someone please give help me. Any suggestions,solutions or ideas as to what the problem might be would be appreciated.
Thanks much,
Alex.HTTP is not SMTP.
Your proxy server no doubt allows your system to send
HTTP traffic to and from the outside world, and using
that code you posted would allow Java classes to do
that as well. But HTTP is not SMTP. Ask the network
people who configured your proxy server if it can act
as an SMTP proxy, and if so what you have to do to
use it in that way.Thanks much for your reply. I am however a little confused. Could you explain to me exactly what an SMTP proxy is/does.
Thanks much,
Alex. -
Unknown SMTP host exception...
Hi all...
am a newbie in j2ee...i have to send mails from my application...
have written the code...but it gives an error like the smtp host specified, is
unknown...
can anyone pleaz tell me what r the things to be set up or what r the configurations to be done to send a mail using program...am using Transport.send(message) function to do it...plz help me...
thanx and regards,
sand...Hi,
As mentioned in the debugging steps, I turned the debugging session on by "session.setDebug(true);".I got the following printed on my console:
DEBUG: setDebug: JavaMail version 1.4ea
DEBUG: getProvider() returning javax.mail.Provider[TRANSPORT,smtp,com.sun.mail.smtp.SMTPTransport,Sun Microsystems, Inc]
DEBUG SMTP: useEhlo true, useAuth false
DEBUG SMTP: trying to connect to host "smtp.gmail.com", port 25, isSSL false
MessagingException
javax.mail.MessagingException: Unknown SMTP host: smtp.gmail.com;
nested exception is:
java.net.UnknownHostException: smtp.gmail.com
at com.sun.mail.smtp.SMTPTransport.openServer(SMTPTransport.java:1280)
at com.sun.mail.smtp.SMTPTransport.protocolConnect(SMTPTransport.java:370)
at javax.mail.Service.connect(Service.java:275)
at javax.mail.Service.connect(Service.java:156)
at javax.mail.Service.connect(Service.java:105)
at javax.mail.Transport.send0(Transport.java:168)
at javax.mail.Transport.send(Transport.java:98)
at sendMail.main(sendMail.java:28)
Caused by: java.net.UnknownHostException: smtp.gmail.com
at java.net.PlainSocketImpl.connect(Unknown Source)
at java.net.SocksSocketImpl.connect(Unknown Source)
at java.net.Socket.connect(Unknown Source)
at java.net.Socket.connect(Unknown Source)
at com.sun.mail.util.SocketFetcher.createSocket(SocketFetcher.java:232)
at com.sun.mail.util.SocketFetcher.getSocket(SocketFetcher.java:189)
at com.sun.mail.smtp.SMTPTransport.openServer(SMTPTransport.java:1250)
... 7 more
I also tried to use telnet to connect as
telnet smtp.gmail.com 25
Here I got an output like
Connecting To smtp.gmsil.com...Could not open connection to the host, on port 25
: Connect failed
so now I donot understand wher the problem lies actually.
Can you please suggest anything?
Thanks -
Javax.servlet.ServletException: Unknown SMTP host
Hi
I am using tomcat and trying to send emails. I keep getting a javax.servlet.ServletException: Unknown SMTP host error.
I initially thought the problem was with the line: props.put("mail.smtp.host", "makethegrade.co.za"); But i checked the smtp info with the guys i'm hosing with and they said its right
I am currently setting the fields manually, so it can't be a problem with passing data around in the webpage
In my WEB-INF/lib i have jaf-1.0.2 and javamail-1.4.1 (i.e. mail.jar and activation.jar)
The code for my mailer bean is:
package mailer;
import java.io.*;
import java.util.*;
import javax.mail.*;
import javax.mail.event.*;
import javax.mail.internet.*;
public final class MailerBean extends Object implements Serializable {
/* Bean Properties */
private String to = null;
private String from = null;
private String subject = null;
private String message = null;
public static Properties props = null;
public static Session session = null;
static {
/* Setting Properties for STMP host */
props = System.getProperties();
props.put("mail.smtp.host", "makethegrade.co.za");
session = Session.getDefaultInstance(props, null);
/* Setter Methods */
public void setTo(String to) {
this.to = to;
public void setFrom(String from) {
this.from = from;
public void setSubject(String subject) {
this.subject = subject;
public void setMessage(String message) {
this.message = message;
/* Sends Email */
public void sendMail() throws Exception {
if(!this.everythingIsSet())
throw new Exception("Could not send email.");
try {
MimeMessage message = new MimeMessage(session);
message.setRecipient(Message.RecipientType.TO,
new InternetAddress(this.to));
message.setFrom(new InternetAddress(this.from));
message.setSubject(this.subject);
message.setText(this.message);
Transport.send(message);
} catch (MessagingException e) {
throw new Exception("Caught in sendMail" + e.getMessage());
/* Checks whether all properties have been set or not */
private boolean everythingIsSet() {
if((this.to == null) || (this.from == null) ||
(this.subject == null) || (this.message == null))
return false;
if((this.to.indexOf("@") == -1) ||
(this.to.indexOf(".") == -1))
return false;
if((this.from.indexOf("@") == -1) ||
(this.from.indexOf(".") == -1))
return false;
return true;
}and the error i get is:
org.apache.jasper.JasperException: Exception in JSP: /processingPages/mailer.jsp:17
14: mailer.setFrom("[email protected]");
15: mailer.setSubject("mailer test");
16: mailer.setMessage("TEst test test");
17: mailer.sendMail();
18:
19: %>
20: </jsp:useBean>
Stacktrace:
org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:451)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:355)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:329)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:265)
javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
root cause
javax.servlet.ServletException: Unknown SMTP host: mail.yourisp.com
org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextImpl.java:841)
org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:774)
org.apache.jsp.processingPages.mailer_jsp._jspService(mailer_jsp.java:89)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:98)
javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:331)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:329)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:265)
javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
root cause
java.lang.Exception: Unknown SMTP host: mail.yourisp.com
mailer.MailerBean.sendMail(MailerBean.java:54)
org.apache.jsp.processingPages.mailer_jsp._jspService(mailer_jsp.java:67)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:98)
javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:331)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:329)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:265)
javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
Tomcat logs give:
Jul 15, 2009 10:50:35 AM org.apache.catalina.core.StandardWrapperValve invoke
SEVERE: Servlet.service() for servlet jsp threw exception
java.lang.Exception: Unknown SMTP host: mail.yourisp.com
at mailer.MailerBean.sendMail(MailerBean.java:54)
at org.apache.jsp.processingPages.mailer_jsp._jspService(mailer_jsp.java:67)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:98)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:331)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:329)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:265)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:269)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:172)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:117)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:108)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:174)
at org.apache.jk.server.JkCoyoteHandler.invoke(JkCoyoteHandler.java:200)
at org.apache.jk.common.HandlerRequest.invoke(HandlerRequest.java:283)
at org.apache.jk.common.ChannelSocket.invoke(ChannelSocket.java:773)
at org.apache.jk.common.ChannelSocket.processConnection(ChannelSocket.java:703)
at org.apache.jk.common.ChannelSocket$SocketConnection.runIt(ChannelSocket.java:895)
at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:689)
at java.lang.Thread.run(Thread.java:619)
If anyone needs any other details feel free to ask.
Any help or any pointers to a place to find a solution would be deeply appreciated
ThanksAll I can see is that you are running this in a web application. In most web application containers there's a place where you configure your mail providers and mail sessions. You seem to be ignoring that (you aren't using JNDI to get a session for example) but you are getting the default instance, so perhaps that uses that configuration anyway.
-
Getting nested exception(Unknown SMTP host)
hello
i have written a simple mailclient.i am running the following programme from my local machine which is under proxy server.
public class MailExample {
public static void main (String args[]) throws Exception {
String host = "mail.ab";
String from = "[email protected]";
String to = "[email protected]";
Properties props = System.getProperties();
props.put("mail.smtp.host", host);
Session session = Session.getDefaultInstance(props, null);
MimeMessage message = new MimeMessage(session);
message.setFrom(new InternetAddress(from));
message.addRecipient(Message.RecipientType.TO,
new InternetAddress(to));
message.setSubject("Hello JavaMail");
message.setText("Welcome");
Transport.send(message);
This host is some other machine.
i am getting nested exception as unknown SMTP host.
please help.
thanks in advanceUnknown host: it is telling you that it can't find the host you told it to look for. Either you gave it the name of a system that does not exist, or that system does not have an SMTP host running on it. I would guess the first reason, as "mail.ab" does not look right to me. (What country is "ab" and why is there only one mail server in the entire country?)
-
Is it necessary to have Exchange server on the pc in which u r making a web application
having email option...?
Tomcat is giving this error although i have provided the mail server ip as follows...
Properties props = new Properties();
props.put("mail.smtp.host", 192.168.0.2);
Session s = Session.getInstance(props,null);
Urgent....Help me please.........
-
Getting exception: Unknown SMTP-- after running the following
Dear Sir,
I am running the demo example of the javamail api but I am getting the following message.
D:\Sots\Java\javamail-1.3.3_01\demo>java msgsend -o [email protected] -M SMTP.Server [email protected]
To: [email protected]
Subject: Hi
Welcome
^Z
javax.mail.MessagingException: Unknown SMTP host: SMTP.Server;
nested exception is:
java.net.UnknownHostException: SMTP.Server
at com.sun.mail.smtp.SMTPTransport.openServer(SMTPTransport.java:1225)
at com.sun.mail.smtp.SMTPTransport.protocolConnect(SMTPTransport.java:32
2)
at javax.mail.Service.connect(Service.java:236)
at javax.mail.Service.connect(Service.java:137)
at javax.mail.Service.connect(Service.java:86)
at javax.mail.Transport.send0(Transport.java:150)
at javax.mail.Transport.send(Transport.java:80)
at msgsend.main(msgsend.java:165)
Thanks and Regards.
Narendra MohanDear Sir,
I am running the demo example of the javamail api but I am getting the following message.
D:\Sots\Java\javamail-1.3.3_01\demo>java msgsend -o [email protected] -M SMTP.Server [email protected]
To: [email protected]
Subject: Hi
Welcome
^Z
javax.mail.MessagingException: Unknown SMTP host: SMTP.Server;
nested exception is:
java.net.UnknownHostException: SMTP.Server
at com.sun.mail.smtp.SMTPTransport.openServer(SMTPTransport.java:1225)
at com.sun.mail.smtp.SMTPTransport.protocolConnect(SMTPTransport.java:32
2)
at javax.mail.Service.connect(Service.java:236)
at javax.mail.Service.connect(Service.java:137)
at javax.mail.Service.connect(Service.java:86)
at javax.mail.Transport.send0(Transport.java:150)
at javax.mail.Transport.send(Transport.java:80)
at msgsend.main(msgsend.java:165)
Thanks and Regards.
Narendra Mohan -
i got some error msg
error - javax.mail.MessagingException: Unknown SMTP host: smtp.gmail.com; nested exception is: java.net.UnknownHostException: smtp.gmail.com
code Properties props = new Properties();
props.put("mail.smtp.host", "smtp.gmail.com");
props.put("mail.smtp.port", "465");
props.put("mail.user","dineshjweerakkody");
Session mailSession = Session.getDefaultInstance(props, null);
MimeMessage msg = new MimeMessage(mailSession);
msg.setFrom(new InternetAddress(request.getParameter("mymail"),request.getParameter("myname")));
msg.addRecipient(Message.RecipientType.TO,new InternetAddress(request.getParameter("resmail"),request.getParameter("resname")));
msg.setSubject(request.getParameter("subject"));
msg.setText(request.getParameter("message"));
Transport.send(msg);
response.sendRedirect("success.jsp");
Please help me...............See the JavaMail FAQ for tips on debugging connection problems.
-
Javamail smtp.host value for gmail
my email account created on gmail.
i want to create mailing site.
now i got some error massage
"Unknown SMTP host: smtp.gmail.com:465"
Please tell me what is the smtp.host value for gmailDon't put the port number in the host name.
See the JavaMail FAQ for how to connect to gmail. -
Javax.mail.MessagingException: Could not connect to SMTP host:
here is a part of my code
import javax.mail.*;
import javax.mail.internet.*;
import java.util.*;
public class Mail {
/** Creates a new instance of PostMail */
public Mail() {
public void postMail( String recipients[ ], String subject, String message , String from) throws MessagingException
boolean debug = false;
//Set the host smtp address
Properties props = new Properties();
props.put("mail.smtp.host", "smtp."_____".com");
// create some properties and get the default Session
Session session = Session.getDefaultInstance(props, null);
session.setDebug(debug);
// create a message
Message msg = new MimeMessage(session);
// set the from and to address
InternetAddress addressFrom = new InternetAddress(from);
msg.setFrom(addressFrom);
InternetAddress[] addressTo = new InternetAddress[recipients.length];
for (int i = 0; i < recipients.length; i++)
addressTo[i] = new InternetAddress(recipients);
msg.setRecipients(Message.RecipientType.TO, addressTo);
// Optional : You can also set your custom headers in the Email if you Want
msg.addHeader("MyHeaderName", "myHeaderValue");
// Setting the Subject and Content Type
msg.setSubject(subject);
msg.setContent(message, "text/plain");
Transport.send(msg);
Here is the exception i rec'vd
javax.mail.MessagingException: Could not connect to SMTP host: smtp.google.com, port: 25;
nested exception is:
java.net.ConnectException: Connection refused: connect
at com.sun.mail.smtp.SMTPTransport.openServer(SMTPTransport.java:1282)
at com.sun.mail.smtp.SMTPTransport.protocolConnect(SMTPTransport.java:370)
at javax.mail.Service.connect(Service.java:275)
at javax.mail.Service.connect(Service.java:156)
at javax.mail.Service.connect(Service.java:105)
at javax.mail.Transport.send0(Transport.java:168)
at javax.mail.Transport.send(Transport.java:98)
at Mail.postMail(Mail.java:45)
at ArchMain.<init>(ArchMain.java:30)
at ArchMain$6.run(ArchMain.java:360)
at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:209)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:597)
at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:273)
at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:183)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:173)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:168)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:160)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:121)
Caused by: java.net.ConnectException: Connection refused: connect
at java.net.PlainSocketImpl.socketConnect(Native Method)
at java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:333)
at java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:195)
at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:182)
at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:366)
at java.net.Socket.connect(Socket.java:519)
at java.net.Socket.connect(Socket.java:469)
at com.sun.mail.util.SocketFetcher.createSocket(SocketFetcher.java:232)
at com.sun.mail.util.SocketFetcher.getSocket(SocketFetcher.java:189)
at com.sun.mail.smtp.SMTPTransport.openServer(SMTPTransport.java:1250)
... 17 morepackage MailDao;
import javax.mail.*;
import javax.mail.internet.*;
import java.util.*;
import java.io.*;
import java.text.*;
import java.text.DateFormat.* ;
import java.io.*;
import javax.mail.*;
import javax.mail.internet.*;
import javax.servlet.*;
import javax.servlet.http.*;
import javax.activation.*;
import javax.mail.search.*;
import java.util.Vector.*;
import java.sql.*;
public class SendMail {
String SMTP_HOST_NAME = "smtp.techpepstechnology.com";//smtp.genuinepagesonline.com"; //techpepstechnology.com";
String SMTP_AUTH_USER = "[email protected]"; //[email protected]"; //techpeps";
String SMTP_AUTH_PWD = "demo"; //techpeps2007";
public void postMail( String recipients[ ], String subject,
String message , String from,String msgType) throws MessagingException {
boolean debug = false;
Properties props = System.getProperties();
props.put("mail.transport.protocol", "smtp");
props.put("mail.smtp.host", SMTP_HOST_NAME);
props.put("mail.smtp.auth", "true");
Authenticator auth = new SMTPAuthenticator();
Session session = Session.getInstance(props, auth);
session.setDebug(debug);
// create a message
MimeMessage msg = new MimeMessage(session);
// MimeMessage mimemessage = new MimeMessage(simplemailuser.getSession());
// set the from and to address
InternetAddress addressFrom = new InternetAddress(from);
msg.setFrom(addressFrom);
InternetAddress[] addressTo = new InternetAddress[recipients.length];
for (int i = 0; i < recipients.length; i++) {
addressTo[i] = new InternetAddress(recipients);
msg.setRecipients(Message.RecipientType.TO, addressTo);
// Setting the Subject and Content Type
msg.setSubject(subject);
if(msgType.equalsIgnoreCase("")) {
//mimemessage.setText(s4);
msg.setContent(message, "text/plain");
else {
MimeBodyPart textBodyPart = new MimeBodyPart();
textBodyPart.setText(message);
MimeBodyPart fileBodyPart = new MimeBodyPart();
FileDataSource fds = new FileDataSource(msgType);
fileBodyPart.setDataHandler(new DataHandler(fds));
fileBodyPart.setFileName(fds.getName());
//step:5 create the multipart/container to hold the part
Multipart container = new MimeMultipart();
container.addBodyPart(textBodyPart);
container.addBodyPart(fileBodyPart);
//step:6 add the multipart to the actual message
msg.setContent(container);
try{
Transport transport=session.getTransport("smtp");
transport.connect();
transport.send(msg);
transport.close();
}catch(Exception e) {
e.printStackTrace();
private class SMTPAuthenticator extends javax.mail.Authenticator {
public PasswordAuthentication getPasswordAuthentication() {
String username = SMTP_AUTH_USER;
String password = SMTP_AUTH_PWD;
return new PasswordAuthentication(username, password);
public static void main(String arg[]) {
SendMail sm = new SendMail();
String[] s ={"[email protected]"};
try{
sm.postMail(s,"hello","This is testing of mail","[email protected]","");
catch(Exception e)
e.printStackTrace();
//sm.sendMsg("demo", "demo");
System.out.println("Mail Sent");
i also got the follwing error this code work fine in jcreator but i used this in netbeans it throws a exception
plz.....help
javax.mail.MessagingException: Could not connect to SMTP host: smtp.techpepstechnology.com, port: 25;
nested exception is:
java.net.ConnectException: Connection refused: connect
at com.sun.mail.smtp.SMTPTransport.openServer(SMTPTransport.java:867)
Mail Sent
at com.sun.mail.smtp.SMTPTransport.protocolConnect(SMTPTransport.java:156)
at javax.mail.Service.connect(Service.java:256)
at javax.mail.Service.connect(Service.java:135)
at javax.mail.Service.connect(Service.java:87)
at com.sun.mail.smtp.SMTPTransport.connect(SMTPTransport.java:93)
at MailDao.SendMail.postMail(SendMail.java:86)
at MailDao.SendMail.main(SendMail.java:110) -
Can't send command to SMTP host
Hi,
I am using Jdev11.1.1.2.0 and web logic servere10.3.I am using mail scheduling in weblogic.Actually in window server 2003 I am getting exception is
get message method--->Can't send command to SMTP host
javax.mail.MessagingException: Can't send command to SMTP host;
nested exception is:
javax.net.ssl.SSLHandshakeException: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
But same application windows7 Its working.
So can u give me the idea ? or any configuration webloigc in windows server 2003 ?
Plz help me.
Thanks
AnupI put environment variable (path) weblogic.jar but still same issue
get message method--->Can't send command to SMTP host
javax.mail.MessagingException: Can't send command to SMTP host;
nested exception is:
javax.net.ssl.SSLHandshakeException: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
at com.sun.mail.smtp.SMTPTransport.sendCommand(SMTPTransport.java:1564)
Plz give me the solution..
Thanks
Anup -
Hi Gurus,
is there any table which stores the SMTP Host Name in the Database? Appreciate your responses.
Thanks!Hi;
Please check below note which could be helpful:
Unable To Email Dunning Letters - Could not connect to SMTP host [ID 460664.1]
How to Perform a Meaningful SMTP Telnet Test to Troubleshoot Java Mailer For Sending Email Notifications [ID 753845.1]
XML Gateway Fails To Send Workflow Message -- javax.mail.MessagingException: Could Not Connect To SMTP Host [ID 863314.1]
Regard
Helios -
Javamail ignoring mail.smtp.host?
Hi all,
I have some code that looks like this (OK, this is oversimplified):
private void sendMessage(SMTPMessage message, String username, String domain) throws MessagingException
bq. String mxHost = getMXHostnames(domain)[0]; \\ Properties sessionProperties = new Properties(); \\ sessionProperties.put("mail.smtp.host", mxHost ); // This line is important! \\ Session session = Session.getInstance(sessionProperties); \\ URLName targetUrl = new URLName("SMTP", mxHost, 25, null, null, null); \\ SMTPTransport transport = new SMTPTransport(session, targetUrl); Address[] addr = new Address[]() {new InternetAddress(username \\ + '@' + domain)}; \\ transport.send(message, addrArray);
username and domain are variables containing a target address, and getMXHostnames() is a function returning an array of MX host names, sorted in order of preference, for a supplied domain name (I can verify that this works, or at least that it generates an array of very plausible-looking domain names, none of which is "localhost".
When I run this code, however, I get:
javax.mail.MessagingException: Could not connect to SMTP host: localhost, port: 25
Where is that "localhost" coming from? I specified a value for mail.smtp.host, and it's not localhost! (An example is "mx1.balanced.swarthy.mail.dreamhost.com", for webmail hosted by DreamHost.)
Any help would be much appreciated.
Thanks much,
Avromdrvijayy2k2 wrote:
sessionProperties.put("mail.smtp.host", mxHost ); // This line is important! what mail.smtp.host is just like demo..
use yours...
ex
smtp.gmail.com
Sorry, I should have made it a bit clearer what I'm trying to do. This isn't mail client; it is (and yes, I know the FAQ suggests that
JavaMail isn't quite appropriate for this, so maybe I shouldn't be
asking this question at all^1^) an originating SMTP server. At
some point in the SMTP server chain, you have to connect to the
receiving server. I'm hoping that I can do that directly; if I can't, I
need to find out how to discover the appropriate relay to get it there.
(Do all originators need to connect to an "upstream" server for which
they have an account? How do the upstream servers send mail, in that
case?)
"My" SMTP server, I assume you mean, is the server I have an account on and a password for. But (IIUC), the MX servers listed in a site's WHOIS entry are public receiving servers--they're what smtp.google.com (for example) uses to deliver messages to email addresses at that web site. Surely they can't require usernames and passwords, because they need to have a general ability to receive email from outside. (These are different from SMTP originators, which are really only for the use of a select few.)
(Anyway, why would you list servers in a WHOIS entry when they require an account? You can inform your account holders of your SMTP servers without using WHOIS).
bshannon, sorry, but there's something I'm failing to see in the
samples (possibly due to my not seeing it, rather than its not being there). All of them assume you use your session object in the
construction of the MimeMessage: new MimeMessage(session). I've already
received and processed a MimeMessage from the actual client; if I don't
intantiate my own transport, how do I tell the SmtpMessage about my
session (with customized properties, especially smtp host)?
I really don't want to put the session in the message constructor if I
can possibly help it--because the same MimeMessage might go to a bunch
of different receiving smtp hosts (if it has a long to line, for
example). Re-reading the content for each of them seems wildly
inefficient compared to creating a single Mime message, and then
creating different sessions to send the message to different places.
drvijayy2k2, I understand that thread and in fact have posted on it. But again, that person was trying to create a client that connected to an SMTP provider. I'm trying to be the SMTP provider, and deliver mail to receiving servers.
^1^On the other hand, I've looked at extensible Java servers available on the net, and they all really seem to be primarily intended as SMTP receivers, not SMTP originators. I've actually got a (home-brewed, and currently pretty basic) receiving SMTP system working just fine (and the server component of my originator fine; it's the bit that sends the mail along that I'm having trouble with), but I need to provide a way to send mail, not just receive it. If JavaMail isn't robust enough (as the FAQ suggests) for this purpose, then it looks like eventually I'll need an entirely home-brewed system, but for my prototype, time to completion is rather more important than real robustness. I don't expect the prototype to need to handle a big load, for example. -
Guided Procedures - set mail smtp host
Hi,
I want to set the smtp host to use email notifications in a Guided Procedures process. So I go in the portal to:
Guided Procedures -> Administration -> GP Configuration Tool -> Interactive Forms -> SMTP Server
When I click on the Save button I get
java.lang.NullPointerException
at com.sap.caf.eu.gp.ui.conf.iforms.CInteractiveForms.validate(CInteractiveForms.java:382)
I tried it on another CE installation with the same result. This seems like a bug. Is there another way to set the smtp host in GP? Below the stack trace..
Regards, Kevin
java.lang.NullPointerException
at com.sap.caf.eu.gp.ui.conf.iforms.CInteractiveForms.validate(CInteractiveForms.java:382)
at com.sap.caf.eu.gp.ui.conf.iforms.CInteractiveForms.save(CInteractiveForms.java:442)
at com.sap.caf.eu.gp.ui.conf.iforms.wdp.InternalCInteractiveForms.save(InternalCInteractiveForms.java:215)
at com.sap.caf.eu.gp.ui.conf.iforms.CInteractiveFormsInterface.save(CInteractiveFormsInterface.java:186)
at com.sap.caf.eu.gp.ui.conf.iforms.wdp.InternalCInteractiveFormsInterface.wdInvokeMethod(InternalCInteractiveFormsInterface.java:196)
at com.sap.tc.webdynpro.progmodel.generation.ExternalControllerPI$ExternalInterface.invoke(ExternalControllerPI.java:291)
at $Proxy483_10002.save(Unknown Source)
at com.sap.caf.eu.gp.ui.gpconf.app.CConfigApp.saveWizard(CConfigApp.java:317)
at com.sap.caf.eu.gp.ui.gpconf.app.wdp.InternalCConfigApp.saveWizard(InternalCConfigApp.java:158)
at com.sap.caf.eu.gp.ui.gpconf.app.VConfigApp.onActionSave(VConfigApp.java:430)
at com.sap.caf.eu.gp.ui.gpconf.app.wdp.InternalVConfigApp.wdInvokeEventHandler(InternalVConfigApp.java:247)
at com.sap.tc.webdynpro.progmodel.generation.DelegatingView.invokeEventHandler(DelegatingView.java:131)
at com.sap.tc.webdynpro.progmodel.controller.Action.fire(Action.java:72)
at com.sap.tc.webdynpro.clientserver.phases.ProcessingEventPhase.doHandleActionEvent(ProcessingEventPhase.java:156)
at com.sap.tc.webdynpro.clientserver.phases.ProcessingEventPhase.execute(ProcessingEventPhase.java:91)
at com.sap.tc.webdynpro.clientserver.window.WindowPhaseModel.processRequestPartly(WindowPhaseModel.java:161)
at com.sap.tc.webdynpro.clientserver.window.WindowPhaseModel.doProcessRequest(WindowPhaseModel.java:109)
at com.sap.tc.webdynpro.clientserver.window.WindowPhaseModel.processRequest(WindowPhaseModel.java:96)
at com.sap.tc.webdynpro.clientserver.window.WebDynproWindow.processRequest(WebDynproWindow.java:469)
at com.sap.tc.webdynpro.clientserver.cal.AbstractClient.executeTasks(AbstractClient.java:52)
at com.sap.tc.webdynpro.clientserver.cal.ClientApplication.doExecute(ClientApplication.java:1388)
at com.sap.tc.webdynpro.clientserver.cal.ClientApplication.doProcessing(ClientApplication.java:1208)
at com.sap.tc.webdynpro.serverimpl.core.sessionctx.AbstractExecutionContextDispatcher.delegateToApplicationDoProcessing(AbstractExecutionContextDispatcher.java:145)
at com.sap.tc.webdynpro.serverimpl.wdc.sessionctx.DispatchHandlerForAppProcessing.doService(DispatchHandlerForAppProcessing.java:35)
at com.sap.tc.webdynpro.serverimpl.wdc.sessionctx.AbstractDispatchHandler.service(AbstractDispatchHandler.java:116)
at com.sap.engine.services.servlets_jsp.server.deploy.impl.module.IRequestDispatcherImpl.dispatch(IRequestDispatcherImpl.java:93)
at com.sap.tc.webdynpro.serverimpl.wdc.sessionctx.ExecutionContextDispatcher.dispatchToApplicationDoProcessing(ExecutionContextDispatcher.java:114)
at com.sap.tc.webdynpro.serverimpl.core.sessionctx.AbstractExecutionContextDispatcher.dispatch(AbstractExecutionContextDispatcher.java:80)
at com.sap.tc.webdynpro.clientserver.session.ApplicationSession.dispatch(ApplicationSession.java:506)
at com.sap.tc.webdynpro.clientserver.session.ApplicationSession.dispatch(ApplicationSession.java:526)
at com.sap.tc.webdynpro.clientserver.session.ApplicationSession.doApplicationProcessingStandalone(ApplicationSession.java:457)
at com.sap.tc.webdynpro.clientserver.session.ApplicationSession.doProcessing(ApplicationSession.java:248)
at com.sap.tc.webdynpro.clientserver.session.ClientSession.doApplicationProcessing(ClientSession.java:698)
at com.sap.tc.webdynpro.clientserver.session.ClientSession.doProcessing(ClientSession.java:230)
at com.sap.tc.webdynpro.clientserver.session.RequestManager.doProcessing(RequestManager.java:228)
at com.sap.tc.webdynpro.serverimpl.core.sessionctx.AbstractExecutionContextDispatcher.delegateToRequestManager(AbstractExecutionContextDispatcher.java:192)
at com.sap.tc.webdynpro.serverimpl.wdc.sessionctx.DispatchHandlerForRequestManager.doService(DispatchHandlerForRequestManager.java:38)
at com.sap.tc.webdynpro.serverimpl.wdc.sessionctx.AbstractDispatchHandler.service(AbstractDispatchHandler.java:116)
at com.sap.engine.services.servlets_jsp.server.deploy.impl.module.IRequestDispatcherImpl.dispatch(IRequestDispatcherImpl.java:93)
at com.sap.tc.webdynpro.serverimpl.wdc.sessionctx.ExecutionContextDispatcher.dispatchToRequestManager(ExecutionContextDispatcher.java:140)
at com.sap.tc.webdynpro.serverimpl.core.sessionctx.AbstractExecutionContextDispatcher.dispatch(AbstractExecutionContextDispatcher.java:92)
at com.sap.tc.webdynpro.serverimpl.core.sessionctx.AbstractExecutionContextDispatcher.dispatch(AbstractExecutionContextDispatcher.java:104)
at com.sap.tc.webdynpro.serverimpl.core.AbstractDispatcherServlet.doContent(AbstractDispatcherServlet.java:87)
at com.sap.tc.webdynpro.serverimpl.core.AbstractDispatcherServlet.doPost(AbstractDispatcherServlet.java:61)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:727)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:820)
at com.sap.engine.services.servlets_jsp.server.Invokable.invoke(Invokable.java:66)
at com.sap.engine.services.servlets_jsp.server.Invokable.invoke(Invokable.java:32)
at com.sap.engine.services.servlets_jsp.server.HttpHandlerImpl.runServlet(HttpHandlerImpl.java:431)
at com.sap.engine.services.servlets_jsp.server.HttpHandlerImpl.handleRequest(HttpHandlerImpl.java:289)
at com.sap.engine.services.httpserver.server.RequestAnalizer.startServlet(RequestAnalizer.java:387)
at com.sap.engine.services.httpserver.server.RequestAnalizer.startServlet(RequestAnalizer.java:376)
at com.sap.engine.services.servlets_jsp.filters.ServletSelector.process(ServletSelector.java:85)
at com.sap.engine.services.httpserver.chain.AbstractChain.process(AbstractChain.java:71)
at com.sap.engine.services.servlets_jsp.filters.ApplicationSelector.process(ApplicationSelector.java:160)
at com.sap.engine.services.httpserver.chain.AbstractChain.process(AbstractChain.java:71)
at com.sap.engine.services.httpserver.filters.WebContainerInvoker.process(WebContainerInvoker.java:67)
at com.sap.engine.services.httpserver.chain.HostFilter.process(HostFilter.java:9)
at com.sap.engine.services.httpserver.chain.AbstractChain.process(AbstractChain.java:71)
at com.sap.engine.services.httpserver.filters.ResponseLogWriter.process(ResponseLogWriter.java:60)
at com.sap.engine.services.httpserver.chain.HostFilter.process(HostFilter.java:9)
at com.sap.engine.services.httpserver.chain.AbstractChain.process(AbstractChain.java:71)
at com.sap.engine.services.httpserver.filters.DefineHostFilter.process(DefineHostFilter.java:27)
at com.sap.engine.services.httpserver.chain.ServerFilter.process(ServerFilter.java:12)
at com.sap.engine.services.httpserver.chain.AbstractChain.process(AbstractChain.java:71)
at com.sap.engine.services.httpserver.filters.MonitoringFilter.process(MonitoringFilter.java:29)
at com.sap.engine.services.httpserver.chain.ServerFilter.process(ServerFilter.java:12)
at com.sap.engine.services.httpserver.chain.AbstractChain.process(AbstractChain.java:71)
at com.sap.engine.services.httpserver.server.Processor.chainedRequest(Processor.java:309)
at com.sap.engine.services.httpserver.server.Processor$FCAProcessorThread.run(Processor.java:222)
at com.sap.engine.core.thread.impl3.ActionObject.run(ActionObject.java:37)
at java.security.AccessController.doPrivileged(Native Method)
at com.sap.engine.core.thread.impl3.SingleThread.execute(SingleThread.java:152)
at com.sap.engine.core.thread.impl3.SingleThread.run(SingleThread.java:247)Hi Kevin,
I didn't get which release of CE you are using, so I am giving you the procedure for SP3. You set the smtp through the Mail Sending tab page. Here's the procedure:
1. Go to Guided procedure ->
Administration-> Administer BMF->Clients
->select iForms Processor -> press Settings button
-> Mail Sending tab.
2. Set your smtp server in SMTP Server field.
3. Press Save button.
You can test mail sending by pressing Test button
but first you should
configure the mail of the administrator of BMF and
the mail of the administrator of the client
(iForms Processor). Please follow instruction below
BMF Administrator's mail:
1.Go to Guided procedure ->
Administration-> Administer BMF->Settings.
2.Input the mail in Administrator Mail files.
3.Press Save button.
iForms client Administrator's mail:
1. Go to Guided procedure ->
Administration-> Administer BMF->Clients
->select iForms Processor
2. Press Edit button.
3. Input the mail in Administrator Mail files.
4. Press Save button.
Hope this works out
Greets,
Petra -
When will come this error Could not connect to SMTP host: son1175, port: 25
Hi all
we configure SMTP server on Linux ES,my java application run on same server
from my application trying to send a mail i got this error
[0] EmailConnection.getConnection: Attempting connection...
DEBUG: setDebug: JavaMail version 1.3.1
DEBUG: getProvider() returning javax.mail.Provider[TRANSPORT,smtp,com.sun.mail.smtp.SMTPTransport,Sun Microsystems, Inc]
DEBUG SMTP: useEhlo true, useAuth false
DEBUG SMTP: trying to connect to host "son1175", port 25
[0] EmailConnection.getConnection: Cannot connect to server with configuration
smtp://padmanab:*@son1175/. Port = 25. Security: none.
Properties: {mail.port=25, mail.smtp.timeout=30000, mail.smtp.connectiontimeout=30000}
Could not connect to SMTP host: son1175, port: 25;
nested exception is:
java.net.ConnectException: Connection refused
2005-03-30 10:03:03,751 INFO [plt.userManagement] [PoolThread-9] "Password Reset" email could not be sent to vallish at the email address, "[email protected]".
but mail server is configured currectly
please tell cause of this error out java application or my SMTP server
regards
satyaCould not connect to SMTP host: son1175, port: 25;
nested exception is:
java.net.ConnectException: Connection refusedYou didn't notice that this question is asked every day here?
Your computer can't connect to a computer named "son1175", or if it can then that computer isn't running a server listening at port 25. Talk to your network people if your computer name is the right one and ask them why not. It is nothing to do with programming.
Maybe you are looking for
-
Sound no longer playing through Surround Sound via TV
I have had my Mac Mini for about a year now and recently purchased a new 3D LG TV. Prior to that I had another LG hooked up through it and have a Panasonic surround sound system set up with I believe it's a Gefen digital to analog converter, because
-
I have an ipad 3 and i can't sign in to my imessage or facetime.
I have an ipad with retina display and around the time i updated to ios 7 i am not able to log in to my imessage and Facetime. Could not sign in. Please check your internet connection and try again later. My internet is not to problem because my ipho
-
Adobe Illustrator crashes on launch. Please help.
I've tried logging in/out of Creative Cloud and it doesn't work. I've read that maybe it's a font thing but I can't seem to find the font folder. I've launched other apps and they work; it just happens with Illustrator.
-
How can I get a split sceen feature on my Firefox 5.0, with Windows Vista?
We are trying to add Split Panel v 1.0 to Firefox V 5.0. However, when installing the application and then rebooting Firefox and then trying to use it, it redirects us to the current URL: https://addons.mozilla/en-US/firefox/addon/split-panel/.......
-
Hello experts, I have the following issue, we need a Reporting to allow display based on a range of dates (The report, has to see like /SAPTRX/EE_OVD_LIST, i mean a list), taking the expected date of the event, those events that fall within that rang