X.400 instead of SMTP Protocol and Javamail API
We have developed a workflow application on Domino 5.0.7. The SmartHost is "MS Exchange Server", because the application will only be accessed by browsers, we are using javaagent to send the email notifications. Due to some domain restrictions on MS Exhchange servers we have implemented Javamail API on the domino server, and it worked fine (I mean the messages were received by the Exchange Clients, using the SMTP addresses like [email protected]). As we dont have available SMTP addresses for all end users in the company we need to use the X.400 addresses. Is there anyone, can help guide about either the avaiability of any X.400 javamail api, or how to use mapi etc? I know it is little bit challenging, but we are struck. thanks
Currently, the latest version of the JavaMail 1.2 API, X.400 transport protocol is not supported yet. Only the transport SMTP - a message Transport protocol, for sending messages to a server, is supported.
Allen Lai
SUN Developer Technical Support
Similar Messages
-
Getting error when sending SMTP mail using javamail api
hi all
i am new to javamail api...and using it first-time....i'v used the following code
<%
String mailHost="mail.mastsale.com";
String mailText="Hello this is a test msg";
String to="<a href="mailto:[email protected]">[email protected]</a>";
String subject="jsp test mail";
try
String from="<a href="mailto:[email protected]">[email protected]</a>";
String mailhost = "mail.mastsale.com";
Properties props = System.getProperties();
props.put("mail.smtp.host", mailhost);
// Get a Session object
Authenticator auth = new SMTPAuthenticator( "<a href="mailto:[email protected]">[email protected]</a>", "abcd" );
Session session1 = Session.getInstance(props,auth);
//Session.setDebug(true);
//construct message
Message msg = new MimeMessage(session1);
msg.setFrom(new InternetAddress(from,"Your Name"));
msg.setRecipients(Message.RecipientType.TO, InternetAddress.parse(to, false));
msg.setSubject(subject);
msg.setText(mailText);
//msg.setHeader("X-Mailer",mailer);
msg.setSentDate(new Date());
msg.saveChanges();
//Send the message
out.println("Sending mail to " + to);
Transport.send(msg);
catch (MessagingException me)
out.println("Error in sending message for messaging exception:"+me);
%>
and
SMTPAuthenticator.java
import java.io.*;
import java.util.*;
import java.lang.*;
import javax.mail.*;
import javax.mail.internet.*;
public class SMTPAuthenticator extends javax.mail.Authenticator {
private String fUser;
private String fPassword;
public SMTPAuthenticator(String user, String password) {
fUser = user;
fPassword = password;
public PasswordAuthentication getPasswordAuthentication() {
return new PasswordAuthentication(fUser, fPassword);
Now getting error as: Error in sending message for messaging exception:javax.mail.SendFailedException: Invalid Addresses; nested exception is: com.sun.mail.smtp.SMTPAddressFailedException: 550-(host.hostonwin.com) [208.101.41.106] is currently not permitted to relay 550-through this server. Perhaps you have not logged into the pop/imap server 550-in the last 30 minutes or do not have SMTP Authentication turned on in your 550 email client.
Can anyone help me?i got the following error while using the below code,
-----------registerForm----------------
DEBUG: setDebug: JavaMail version 1.3.2
DEBUG: getProvider() returning javax.mail.Provider[TRANSPORT,smtp,com.sun.mail.smtp.SMTPTransport,Sun Microsystems, Inc]
DEBUG SMTP: useEhlo true, useAuth true
:::::::::::::::::::::::::::::::::<FONT SIZE=4 COLOR="blue"> <B>Error : </B><BR><HR> <FONT SIZE=3 COLOR="black">javax.mail.AuthenticationFailedException<BR><HR>
-----------registerForm----------------
public class SendMailBean {
public String send(String p_from, String p_to, String p_cc, String p_bcc,
String p_subject, String p_message, String p_smtpServer,String FilePath) {
String l_result = "";
// Name of the Host machine where the SMTP server is running
String l_host = p_smtpServer;
//for file attachment
String filename = FilePath;
// Gets the System properties
Properties l_props = System.getProperties();
// Puts the SMTP server name to properties object
l_props.put("mail.smtp.host", l_host);
l_props.put("mail.smtp.auth", "true");
// Get the default Session using Properties Object
Session l_session = Session.getDefaultInstance(l_props, null);
l_session.setDebug(true); // Enable the debug mode
try {
MimeMessage l_msg = new MimeMessage(l_session); // Create a New message
l_msg.setFrom(new InternetAddress(p_from)); // Set the From address
// Setting the "To recipients" addresses
l_msg.setRecipients(Message.RecipientType.TO,
InternetAddress.parse(p_to, false));
// Setting the "Cc recipients" addresses
l_msg.setRecipients(Message.RecipientType.CC,
InternetAddress.parse(p_cc, false));
// Setting the "BCc recipients" addresses
l_msg.setRecipients(Message.RecipientType.BCC,
InternetAddress.parse(p_bcc, false));
l_msg.setSubject(p_subject); // Sets the Subject
// Create and fill the first message part
MimeBodyPart l_mbp = new MimeBodyPart();
//123
///////l_mbp.setText(p_message);
l_mbp.setContent(p_message,"text/html");
// Create the Multipart and its parts to it
Multipart l_mp = new MimeMultipart();
//l_mp.setContent(html,"text/html");
l_mp.addBodyPart(l_mbp);
// Add the Multipart to the message
l_msg.setContent(l_mp,"text/html");
// Set the Date: header
l_msg.setSentDate(new Date());
//added by cibijaybalan for file attachment
// attach the file to the message
//Multipart l_mp1 = new MimeMultipart();
if(!filename.equals(""))
String fname = filename;
MimeBodyPart mbp2 = new MimeBodyPart();
FileDataSource fds = new FileDataSource(fname);
mbp2.setDataHandler(new DataHandler(fds));
mbp2.setFileName(fds.getName());
l_mp.addBodyPart(mbp2);
// add the Multipart to the message
l_msg.setContent(l_mp);
//ends here
l_msg.setSentDate(new java.util.Date());
// Send the message
Transport.send(l_msg);
// If here, then message is successfully sent.
// Display Success message
l_result = l_result + "Mail was successfully sent to : "+p_to;
//if CCed then, add html for displaying info
//if (!p_cc.equals(""))
//l_result = l_result +"<FONT color=green><B>CCed To </B></FONT>: "+p_cc+"<BR>";
//if BCCed then, add html for displaying info
//if (!p_bcc.equals(""))
//l_result = l_result +"<FONT color=green><B>BCCed To </B></FONT>: "+p_bcc ;
//l_result = l_result+"<BR><HR>";
} catch (MessagingException mex) { // Trap the MessagingException Error
// If here, then error in sending Mail. Display Error message.
l_result = l_result + "<FONT SIZE=4 COLOR=\"blue\"> <B>Error : </B><BR><HR> "+
"<FONT SIZE=3 COLOR=\"black\">"+mex.toString()+"<BR><HR>";
} catch (Exception e) {
// If here, then error in sending Mail. Display Error message.
l_result = l_result + "<FONT SIZE=4 COLOR=\"blue\"> <B>Error : </B><BR><HR> "+
"<FONT SIZE=3 COLOR=\"black\">"+e.toString()+"<BR><HR>";
e.printStackTrace();
}//end catch block
//finally {
System.out.println(":::::::::::::::::::::::::::::::::"+l_result);
return l_result;
} // end of method send
} //end of bean
plz help me -
Great website for SMTP protocol reference
I'm writing a class that sends email, and I came accross this page about the SMTP protocol, and it really helped me. I thought maybe someone else would find it useful.
http://cr.yp.to/smtp.html
AlexDon't know what download you got. If it was the "Stub installer" (1mb), it doesn't have the Install Manager.
You need to use:
http://fpdownload.macromedia.com/get/flashplayer/current/licensing/mac/install_flash_playe r_13_osx.dmg <-- the FULL installer (HAS the Install Manager)
or
http://fpdownload.macromedia.com/get/flashplayer/current/licensing/mac/install_flash_playe r_13_osx_pkg.dmg <--- Just the pkg (COCOA installer) -
AuthenticationFailedException when using JNDI and JavaMail with SMTP auth
Hi all - I've been banging my head on this one for awhile now - hopefully someone else has done this.
We are working in a servlet container (tomcat), and need obtain a mail session from JNDI. We do this as follows:
Context initCtx = new InitialContext();
Context envCtx = (Context) initCtx.lookup("java:comp/env");
Session mailSession=(Session) envCtx.lookup("mailSession/trumpetinc");so far so good. The jndi entry for the mail session is configured in server.xml as follows:
<Resource name="mailSession/trumpetinc" scope="Shareable" type="javax.mail.Session"/>
<ResourceParams name="mailSession/trumpetinc">
<parameter>
<name>mail.smtp.host</name>
<value>mail.server.com</value>
</parameter>
<parameter>
<name>mail.smtp.password</name>
<value>ABCDEFG</value>
</parameter>
<parameter>
<name>mail.smtp.user</name>
<value>trumpet_kevin</value>
</parameter>
<parameter>
<name>mail.smtp.auth</name>
<value>true</value>
</parameter>
</ResourceParams>With the above, whenever we hit Transport.send(msg), we got an AuthenticationFailedException thrown. I have run into this before with SMTP authentication, so I decided to try using the transport.sendMessage() method instead.
So, I get the transport:
Transport trans = mailSession.getTransport("smtp");
trans.connect();Then I send my message using:
msg.saveChanges();
trans.sendMessage(msg, msg.getAllRecipients());and finally, I close the transport:
trans.close();Unfortunately, I'm still getting the exception. Is it possible that my connect() method is not picking up the JNDI properties set in the server.xml file (this seems likely)? If so, what's the best way for me to get those properties so I can set them explicitly in the connect() method?
Thanks in advance,
- KevinHi,
I have faced the same problem and after some googling and trying I have discovered what causes the AuthenticationFailedException exception. I just wanted to share the knowedge maybe it will be helpfull to others.
Here it is what the API says:
To use SMTP authentication you'll need to set the mail.smtp.auth property (see below) and provide the SMTP Transport with a username and password when connecting to the SMTP server. You can do this using one of the following approaches:
1.Provide an Authenticator object when creating your mail Session and provide the username and password information during the Authenticator callback.
Note that the mail.smtp.user property can be set to provide a default username for the callback, but the password will still need to be supplied explicitly.
This approach allows you to use the static Transport send method to send messages.
2.Call the Transport connect method explicitly with username and password arguments.
This approach requires you to explicitly manage a Transport object and use the Transport sendMessage method to send the message. The transport.java demo program demonstrates how to manage a Transport object. The following is roughly equivalent to the static Transport send method, but supplies the needed username and password:
Using the Transport.connect makes the JNDI not very helpfull for configuration.
It seems that using just the mail.smtp.user and mail.smtp.pass is not sufficient for the authentication.
so, the solution is :
just place these to lines in the JNDI configuration:
username="test"
password="test1"
so it should looks as follows:
<Resource name="mail/Session" auth="Container"
type="javax.mail.Session"
username="test"
password="test1"
mail.transport.protocol="smtp"
mail.smtp.auth="true"
mail.smtp.host="localhost"
mail.smtp.port="25"
mail.smtp.user="test"
mail.smtp.password="test1"
/>
where test and test1 are the user's credentials
Regards,
Kiril
Message was edited by:
Kireto
Message was edited by:
Kireto -
What is difference between transport protocol and message protocol
what is difference between transport protocol and message protocol
please give definition and small explanationHi,
Transport protocol gives information about outside of message details, kind of system, security details.
A transport protocol is a network protocol that has the capability of transferring some payload from one node to another, thus providing some level of transparency from the underlying network.
Transport protocols are used as a mechanism to move payloads around a network. Typically, a payload will have a transport binding associated with it. For example, SOAP (acting as a payload) has a predetermined binding for HTTP (a transport protocol).
Some common transport protocols include: HTTP, HTTP-R, SMTP and BEEP.
Message protocol gives you an idea of message type XI payload
http://help.sap.com/saphelp_nw04/helpdata/en/b6/0b733cb7d61952e10000000a11405a/content.htm -
Enable SAP Inbound email through IMAP, POP3 & MAPI instead of SMTP
Hi,
I am trying to configure SAP Inbound email in CRM 6.0 and would like to know if I can use IMAP, POP3 or MAPI instead of SMTP due to our company's legal policies and maintenance purposes.
If there is a way, please let me know how to?
I have checked other options but none of them talk about IMAP, POP3 or MAPI
*) ICI (Integrated Communication Interface)
*) Agent Inox based on SAP Connect Interface via SAP Business WorkflowCheck
http://help.sap.com/saphelp_crm60/helpdata/en/46/23e545c17b5872e10000000a11466f/content.htm
PI Mail Adapter - http://help.sap.com/saphelp_nw04/helpdata/en/ad/bf93409c663228e10000000a1550b0/frameset.htm
Configuring the Sender Mail Adapter - http://help.sap.com/saphelp_nw04/helpdata/en/ad/bf93409c663228e10000000a1550b0/frameset.htm
Configuring the Receiver Mail Adapter - http://help.sap.com/saphelp_nw04/helpdata/en/ad/bf93409c663228e10000000a1550b0/frameset.htm
Thanks in advanceHello,
As far as I am aware, SMTP is now the only supported option for configuring inbound emails through the SAPConnect interface into the Interaction Center agent inbox.
[SAP Note 455140|https://websmp130.sap-ag.de/sap(bD1lbiZjPTAwMQ==)/bc/bsp/spn/sapnotes/index2.htm?numm=455140]
[SAP Note 1236270|https://websmp130.sap-ag.de/sap(bD1lbiZjPTAwMQ==)/bc/bsp/spn/sapnotes/index2.htm?numm=1236270}
Best regards,
John -
AS2 as transport protocol and AS2xml as message protocol
Dear All
AS2 adapter has been installed in our landscape ,when I am trying to select the transport protocol and message protocol ,I can only see AS2 as transport protocol and AS2xml as the message protocol instead of the normal HTTP/ HTTPs for the Transport protocol and AS2 as message protocol.COuld anyone tell me if there is a problem.We need to send xml messages over the AS2 adapter and receive MDN's.Hi Arjun,
Refer below forum threads which was replied which talks about the configuration which need to be done for AS2 adapter. It will be helpful:
Re: Pls.. Help Needed.. Seeburger Mapping Names..!!
Re: Seeburger AS2 adapter...
Re: AS2 Module tab.. Mapping Names for modified Standard Msg types ? ? BIC ??
AS2 adpater-- Configuration details for both SND and RCV.
Re: Regarding Seeburger AS2 Adapter
Regards,
Vinod. -
Hi,
I have developed an EJB for sending emails using the javamail api.
My problem is that when i run the same code using the a standalone java application (i have pasted the code from the EJB) and try sending mails outside the my companies domain the mails are going.
However when i try sending the mails using the JSP end EJB the mails are not going.
I noticed that in the standalone java application the protected method getPasswordAuthentication gets called by the system. However the same is not getting called in the EJB.
I am new to this technology. Can anyone please help me out here.
I am sending the code also that i am using:-
// Get all the system properties
Properties props = System.getProperties();
props.put("mail.smtp.host", "HOSTNAME");
props.put("mail.smtp.auth", "true");
SetAuthentication auth = new SetAuthentication();
Session session = Session.getInstance(props, auth);
session.setDebug(true);
// Create a message
Message msg = new MimeMessage(session);
try {
// Set the From Address
Address addrFrom =new InternetAddress("[email protected]");
msg.setFrom(addrFrom);
// Set the TO address
Address addrTo = new InternetAddress(strTo);
msg.setRecipient(MimeMessage.RecipientType.TO, addrTo);
// Set the subject of the mail
msg.setSubject(strSubject);
msg.setContent(strContent, "text/plain");
msg.saveChanges();
Transport.send(msg);
// Code in class SetAuthentication
private PasswordAuthentication auth;
public SetAuthentication() {
super();
auth = new PasswordAuthentication("user", "password");
protected PasswordAuthentication getPasswordAuthentication() {
return auth;Hi,
I have worked on JBoss and Weblogic app servers and one can initialize java mail settings in the app server,.I am sorry, i don't know how its done in the app server you are using.
I would suggest you to try the following :
static {
/* Setting Properties for STMP host */
props = System.getProperties();
props.put("mail.smtp.host", "PUT SMTP SERVER HERE");
props.put("mail.smtp.auth", "true");
session = Session.getDefaultInstance(props, null);
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 transport = session.getTransport("smtp");
transport.connect("PUT SMTP SERVER HERE", "PUT USERNAME HERE", "PUT PASSWORD HERE");
message.saveChanges();
transport.sendMessage(message, message.getAllRecipients());
transport.close();
} catch (MessagingException e) {
throw new Exception(e.getMessage()); -
SMTP Protocol Returned a Permanent Error 553
Hi all,
i am facing this problem,
From: [email protected] [SMTP:[email protected]]
To: [email protected]
Your message
Subject: Yamaha Online e-shop product :Yamaha Clavinova CLP 120 with Bench
was not delivered to:
[email protected]
because:
Error transferring to 192.168.124.130; SMTP Protocol Returned a Permanent Error 553 sorry, your envelope sender isn't in my gmf list (#5.7.1)
pls any one have idea in this case...Pls help me.
Thanks in advance.The key is here:
your envelope sender isn't in my gmf list
I don't know what a gmf list is, but the envelope
sender is normally the same as your From address.
It looks like this server is not willing to accept
messages from you because it doesn't know about
you.
If you're not authenticating to the mail server, you
might try that to see if that avoids this problem.
See the JavaMail FAQ. -
Order, Paginate and List emails in JavaMail API
Am able to sendm and retrieve emails in java using JavaMail API but am having a problem. I would like to sort emails by date, subject, sender etc and also display only a subset of emails using pagination.
Message[] msgs = folder.getMessages();
FetchProfile fp = new FetchProfile();
fp.add(FetchProfile.Item.ENVELOPE);
folder.fetch(msgs, fp);The function folder.getMessages(); can take 2 arguments (from_index,to_index), but this is according to the way mail server will transalate. POP server will arrange by date while IMAP is unordered. I would like to order the mails then fetch the getMessages(from_index,to_index).
Another posible way am seeing is fetching all mesages using getMessages() put them in a temporary storage(eg. vector or list), order them and then fetch only the page i want. But this could be very costly in terms of processing resources, which makes me believe there is a better approach and it seems i cant find it.
Can somenone please advice me on what to do. I will be very greatful.
Edited by: kagara on Aug 27, 2008 12:27 PMWith POP3 you have no choice but to download the messages and sort them in the client.
The POP3 protocol simply doesn't provide a "sort" option.
With IMAP, some IMAP servers support a "SORT" extension, although JavaMail doesn't
support it yet. -
Javamail api and Microsoft Exchange
Hi there,
I wonder if there are different settings for the javamail (SMTP, Authentication) when the user is using Micorsoft Exchange.
The problem is that my user doesn't know what is his SMTP (I usually ask them to go to MS Outlook to figure it out) but since he is using the exchange software how can I tell what is the SMTP?
are there different setttings for the javamail api in this case?
thanks
peterP_Primrose and Others,
I too am having the same issues. At my work i have administrative access to our MS Exchange server and have noticed that the server can be set to use OR block access via SMTP, POP or IMAP. Also the type of connection can also be set, Encrypted connections or non-encrypted connections.
Now i my instance I have noted that we have SMTP blocked, therefore no good and i have to swap to IMAP. Yuck. But my problem is that if my application is going to be developed to be used across all environments, will i run into the same problems when using other mail servers, such as Unix servers, etc.
My question to the world is how can you test a connection to a mail server and find out what it's requirements are??? Is there a way to get the settings from the client's system settings (Regedit)??? If this can be done then it's just a matter of building a routine to mirror and set those variables for your JavaMail. -
I'am trying to send an e_mail to myself using the javaMail API.
I have already installed it (and also the Java Activation Framework).
The code is:
import javax.mail.*;
import javax.mail.internet.*;
import java.util.Properties;
import java.util.Date;
import java.io.*;
public class PruebaMail {
public static void main(String[] argv) {
try {
Properties props = new Properties();
Session sendMailSession;
Store store;
Transport transport;
sendMailSession = Session.getInstance(props, null);
props.put("mail.smtp.host", "SMTP.mail.yahoo.com");
Message newMessage = new MimeMessage(sendMailSession);
newMessage.setFrom(new InternetAddress("[email protected]"));
newMessage.setRecipient(Message.RecipientType.TO, new InternetAddress("[email protected]"));
newMessage.setSubject("Prueba 1234");
newMessage.setSentDate(new Date());
newMessage.setText("Le escribimos para informarle que alguien ha respondido a su consulta");
transport = sendMailSession.getTransport("smtp");
transport.send(newMessage);
} catch (MessagingException e1) {
System.out.println("PruebaMail MessagingException:" + e1.getMessage());
.. but, issuing C:\>java PruebaMail .. I get this error:
PruebaMail MessagingException:Sending failed;
nested exception is:
javax.mail.MessagingException: Unknown SMTP host: SMTP.mail.yahoo.com;
nested exception is:
java.net.UnknownHostException: SMTP.mail.yahoo.com
so, my question is:
1. Is something wrong in my code. Do you know an available SMTP server which
allows relaying??
thanks in advance!You can find a SMTP Mailer Component that will easily send email messages, including attachments, at http://www.codecadet.com/components/ComponentDetail.aspx?ComponentID=ei47v8RePm0=. This component provides an easy to use interface/wrapper to the Java Mail API. Souce code and documentation is included.
-
How can I get a pdf. to open in Safari, all i'm getting is a new window with a black, blank page, instead of the pdf., and I don't want to save the file to the desktop, Safari didn't use to do that, and I don't have Adobe in the internet plug in folder.
Hi
Please take a look to this thread Re: Can I refresh the browser rather than open a new tab? -
I can't be the only person who has this problem with iCal- when a month ends on a Saturday I can't drag events into the next month and instead have to cut and paste - a real pain in the butt. I thought there was something called "scroll" but I can't find that.
Yeah that works, but, it involves a click on the event, a click on edit, a click on the date, keystrokes, plus, since you can't see the next month you have to have a calendar in front of you so as to put it to the right date. It's easier just to cut it and advance the month and paste it, once you are in the right month you can move it around helter skelter willy nilly no problems. Although now that you mention it I will try it, maybe it is easier than cut and paste as I don't really care about the date, as long as it gets moved into the right month I can drag it around all I want.
-
Question
When trying to create a desktop icon, it does not go to the URL.....instead I get 'script' and not a website......the script has http//etc but I am not directed to the website......I previously had IE 8 (on Vista).....is that the problem?I do not have any installed plugins....at least none that I know of.....remember I am a new user......Basically, the desktop icon is not going directly to the Mozilla FF to get me to the web site I need to go to.....FF works when I use the Mozilla FF icon.....just not the icons I create.....THANKS!!! I have also tried reinstalling FF and get the same results.....HELP!!!The address beginning with file:/// denotes a saved file (local file). The file may not be present. You can try dragging the site icon of this page on the left edge of the location (Address) bar and release it on the desktop. Please try opening it. If it still shows an error it could be a problem with the system's zone permissions. You can try setting each zone in the Windows Control Panel or IE > '''Internet Options''' > '''Security''' tab to '''Default Level'''.
Maybe you are looking for
-
Adding object to collection outside of unit of work?
Hi, Tried to find the answer in this forum but difficult to know what keywords to use...anyway What I am trying to do is so simple I can only believe I am missing the point somewhat ;-) I have an object Licence that has a Set of LicenceHolders. I hav
-
Problem with importing packages in servlet
Hi all, I am a newbie to java so please bear with me... I am trying to create a java servlet but Eclipse is giving me errors such as: 'the import org.apache.struts cannot be resolved' in the following line: import org.apache.struts.action.Action; My
-
How to achieve logical operator on [Authorize(Roles = ] in MVC
For example, I need to make a controller accessible a user with two roles; role "Admin" and "Editor". How to achieve it. [Authorize(Roles = "Admins")] public class SampleController : BaseController How to do logical operator, such as AND and O
-
Dear Experts, After we changed structure for Query, in related work book, there is a new field: structure display. Actually, we do not need this field as negativation. Could you kind ly let me know how to hide this in work book? Thanks and best regar
-
I just had to do a hard reset on my Blackberry Tour (9630) and I use a Microsoft Exchange Server to deliver my e-mail to my device. Now, whenever I try to view an older e-mails on the device I can't view the whole text of the message and the device s