This question already has answers here:
Closed 12 years ago.
Possible Duplicates:
Sending mail from java
Sending email in Java?
Hi folks,
I want to send emails out of my web application via my email server. I also want to use email templates.
Can you recommend a library? Is Apache-Commons appropriate? or even Java Mail API?
java mail api
Jakarta Commons Email
Sending mail from java
how to send an email from jsp/servlet?
Related
I currently have a web application which sends out an email to localhost:2525, and I've been able to intercept these messages using FakeSMTP Server (http://nilhcem.com/FakeSMTP/). Problem is, I'd like to do so with Java. Is there any way to intercept the email using Java and being able to read the contents of the email in Java?
I want to send mail from java application using javamail through Office 365, which I am able to do.
Now my requirement is that I need to send mail using some template which is already created in Office 365 account.
Moreover I need to add some customized data on the mail template(like mail merge), which I am not able to do.
Can we send mail through javamail using some already created mail template? If so please help me how to do it?
Thanks.
This question already has an answer here:
Is SMTP server required to send mail through web server, by using JavaMail API?
(1 answer)
Closed 8 years ago.
JavaMail sends e-mails using an e-mail server, typically through the SMTP interface of an e-mail provider. Is it necessary to use an e-mail server to send e-mails?
I have a web site that will send e-mails and if possible I'd like to send the e-mails directly from the web site code without using an e-mail server. The JavaMail FAQ says that an e-mail server is required.
Is there a way to send e-mails without using an e-mail server, either with JavaMail or another API?
You need an e-mail server. When you send an email from your address to another address. you are really sending it to a mail server. The protocol used to send to the server is (usually) SMTP.
You can deliver an email directly to one of the SMTP servers mentioned in the MX record of the address's domain. Usually that is a bad idea,though:
Delivering the mail to a local server is fast - you can almost immediately continue and do something else and let the server handle the delivery.
The actual delivery can take some time, for instance the remote mail server might be slow. Or it might reject the mail first - it is a known strategy against spam to tell a sender to try sending a mail a second time, which some spam bots won't do.
Also the mail server can easily try again a day later or so when the remote server is down, this reduces risk of lost mail.
i found using google SMTP as easy way to send mail.
This question already has answers here:
Closed 10 years ago.
Possible Duplicate:
How to send HTTP request in java?
I only have one servlet running on the Tomcat server side. Now I want to send a HTTP request to this servlet from a Swing application, and it's not an APPLET application (because I see some examples sending request from applet). How can I do this?
While you can open a direct socket connection and send the raw HTTP headers & content and receive a response back, I would urge you to take a look at HttpRequestBase.
My question is how to call mail server method through Java? This method is called with JavaScript on the server.
The problem is that the Java Mail API cannot delete message from the server. I use message.setFlag(Flags.Flag.DELETE,true); but it doesn't work.
I don't understand exactly what you want to do, but there is a java mail library available see here:
http://www.oracle.com/technetwork/java/javamail/index.html