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?
Related
I want the email to be sent immediately, currently the application is showing me installed email applications in device where I can recompose the email before sending, I want to send the mail directly without showing installed applications.
I Know javamail but need email .. other user can decompiler app and theft email :)
The way to go is to send the mail via some server, not directly from the device. You would, for example, connect to a REST API that sends out the email for you. Sending an email directly from the device from the user's email address is not (and should not be) possible
There are two ways to send email from android application directly without any intent
using SMTP & JavaMail API follow the link for details
using Webservice( for example PHP script ) so there is a server side code and you hit that URL with param like ( name,subject etc) so basically PHP code send mail at the end and it's very easy to use .
Personally, I suggest you use Webservice because it's simpler than first approach.
** Edit: You can save email in sharedpreferences or database and fetch it from there when you try to send mail rather than hardcoding it to avoid theft email risk.(directly putting mail address inside code)
Anyway you can prevent other from getting your full source code.See this answer
I want to create a restlet service in Java that sends e-mail to the user, I know how to send e-mail using amazonaws service, amazon provides aws-java-sdk.jar to configure all the settings. But now I want to send e-mail using webmin's Sendmail Mail Server.
So my question is: Is there any jar provided by webmin to configure and send e-mail? if NO then,
How can I configure the webmin's Sendmail Mail Server to send e-mail using Java restlet service?
Any help is welcome, it would be great if someone provide any link OR tutorial for this.
I understand that I can send an email through Outlook using javascript and with mailto tag also. mailto tag will also open the default mailing client which will install on PC (did not to use it that all), however in my current situation I did not want to use it.
I want to create a webservice in Java or .Net. I can call the same web service with javascript or ajax that can dispatch an e-mail via SMTP.
Please let me know how to create a web service. Any idea will be helpful.
Thanks.
Useful link
Because your are using an applet already it would be easier just to do the e-mail method in java and call via JavaScript (this may throw unsigned applet warning at start).
Create a method in java that will send the message via smtp
Helpful links:
http://docs.oracle.com/javase/tutorial/deployment/applet/invokingAppletMethodsFromJavaScript.html
Sending Email via gmail smtp server in JAVA
I've been searching for the best way to send an e-mail with an attachment by my java application. I want to use this as an users bug report with logger files. The recipient should be my own e-mail address. I'd prefer the use of an e-mail client.
I tried the following:
Send an e-mail with user authentification like this. I don't want to use this, because the user would need to reveal his e-mail account and password. Furthermore, I'd have to set the properties for every e-mail adress, which is impossible.
Send an e-mail directly to my own e-mail address like this in Listing 16.16 (didnt found an english example). The problem is every e-mail server is using POP authentification nowadays, that means the recipient e-mail server won't accept my e-mail.
Using the mailto URL syntax like this. Doesn't work aswell, because the attachment function isn't working properly in every e-mail client. Best solution so far is to brief the user to add the attachment by himself, after I would put it to his desktop. Or upload the data and add a link to the e-mail body.
The last way I've found is this one. As you could assume this won't work either, because the localhost needs to be connected to the internet and capable enough to send an e-mail.
Hopefully I explained my problem well enough. Is there a different way to send bug reports?
The generally accepted way to get around the problems you describe is to keep all the email logic server side, and then have your application call a web service with the appropriate parameters. It's pretty easy to knock a PHP script / servlet up that will do the job and then send the results on via email, put them in a mysql database or so on.
However, if you can't / don't want to / won't keep this server side, I'd recommend using JavaMail to create a MimeMessage, then using writeTo() to write this to an EML file.
You can then do the usual:
Desktop.getDesktop().open(emlFile);
...which will open the EML file with the default application for handing those files, which is almost always the mail client. Still not foolproof, but if you're determined on sending the email from the client directly I think that's as good as you'll get.
I have been using Java mail API to send mails generated through the Java program. What I want to do now is to send a mail through Thunderbird mail client so that the mail get saved to the sent items folder of the user and the user can resend a mail if it has failed.
I also would like to know if it's possible to get a delivery report in the Java mail API.
Edit
I found out that our mail server is POP3 and it doesn't store mail. So is it a good idea to send another mail to the sender as well and define a rule that categorize those messages?
even if you send it with the java mail api (well gmail at least), you will still be able to see in the sent folder using thunderbird. as a matter of fact, 5 minutes ago, I saw this using a website that I build. I am sending emails using Java API, and when I check the send folder I can see them.
The InBox / Outbox in Thunderbird are normally mapped ti your IMAP-Account. The IMAP-Account is set on a mail server. All your mails and folders are stored on that mail server. the client (Thunderbird) only shows the contant from the server. By remote calls (IMAP-protocol) you can create/delete/edit/move folders and mails on the server. Sending a mail is not part of IMAP. Here you use the SMTP-Protocol. When you configure a mailaccount in Thunderbird you must configure IMAP & SMTP. When you send a mail Thunderbird does the following steps:
- Send Mail by SMTP-Protocol
- Create Mail in Outbox by IMAP-Protocol
SMTP & IMAP are totally different. But if you want to send a mail and see this mail in your outbox you must use both. You can program the same workflow with the java mail api.
If I get your question right, you are looking for a way to trigger mail sending via Mozilla Thunderbird from a Java program (an external program / software running on the same local machine).
You can achieve that via different methods:
calling the Thunderbird binary with command-line arguments
via SimpleMAPI, which Thunderbird supports
via XPCOM, also built into Thunderbird
What you won't be able to achieve easily is getting feedback from Thunderbird about the outcome of triggering / prompting the user to send a mail. But you could achieve that by using more difficult ways of integrating Thunderbird with your external software:
read and parse the actual MBOX inbox / mail sent / profile files in a user's profile. "using the X-Mozilla-Status headers (you could) figure out if a message is a new message (etc). A mbox file is essentially just a flat text file that has a seperator between the messages" (parentheses by me, source)
Write a bridging WebExtension Thunderbird Add-On that integrates in some way with your software. An extension has, via Thunderbird's WebExtensions API, essentially a hook for every feature Thunderbird has and your code Add-On could expose these internals in some way to your software.
AFAIK and sadly Thunderbird, as it ships, exposes no API or similar interface out of the box.