I am using mailtrap.io to test email notification functionality in my application using Java Mail API. It is working perfectly fine.
I need to check if an email notification is being delivered to multiple recipients. Not sure how do test it using mailtrap. Do i need to signup in mailtrap to create another account? Do i need to use that account's credentials also?
You can use forwarding emails, which will work as whitelist inside inbox settings. If Mailtrap will found this emails inside mail header, it will forward this email.
Related
I'm currently working on developing an Email Parsing application using the Java Mail API.
The email service I'm using is Gmail. The 'Mark as SPAM' option seems available only on the Gmail interface. The only action I can perform using the Java Mail API is to move the suspicious emails to SPAM folder. However, this does NOT prevent emails from the spam email ids from appearing back in the INBOX.
So for now I'm maintaining an updated list of spam ids which I check against while going through the Inbox folder. If the 'from' email id is present in the list then I use the following code snippet:
folder.copyMessages(msgs, spamFolder); //Moves email msg to SPAM folder
Does anyone know how I can achieve the 'Mark as SPAM' utility using Java Mail API?
Does it guarantee that emails from the same ids won't appear in Inbox again?
I've seen similar posts on this but with no answers.
There's no way to do that with JavaMail. As far as I know, the Gmail "mark as spam" feature is a Gmail-proprietary feature that's not exposed through the IMAP protocol interface.
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 have developed an app with a login. To help users I would like to send a mail reminding their credentials.. 2 solutions but 2 problems:
1) If I send the mail from the mobile phone (using my gmail account and mail.jar library) Google always reports a possible violation of my account or a suspect access, blocking it. I read several forum page about remove this feature but some people say that Gmail is built to be used by a single person
2) If I send a mail from a php page (using the function mail($mailto,$subject,$message,$header) several mail server put automatically this email into the trash folder.
Any suggestion? How to solve this issue?
Thank you in advance
You could send mail in java (mail.jar or mailServices of Spring Framework). I suggest you to use a mail provider service to send mail. It's better because there many things to care with when you send email ( email does not exist, delay of receiving the email, the current status of email sent, received or read...)
I have just started using mailgun. I am facing an issue. Lets say my domain is test,I have done this
abc#gmail.com--> support#test.mailgun.org --> myAccount#gmail.com
SO I am able to route incoming msgs coming to my gmail account, Now I want if I reply from gmail account to the particular user it should appear like that it is sent from support#test.mailgun.org.
myAccount#gmail.com --> abc#gmailc.com (appeared as it is sent from support#test.mailgun.org)
is it possible????
Language:- Java
Thanx to #Andersen, I got the solution. In gmail we have option in which we can change our mail id and make it look like it is coming from some different id while replying.
1) Go to settings in gmail
2) Click on Accounts
3) Send mail as: Click on Add another email address you own
4) Provide the email id you wish to appear as "Sender ID"
5) provide SMTP connection details which you can see once you login to your mailgun account and click on domain.
6) Save the settings, now when you are replying we can change from id to our custom domain id.
Enjoy
You need something to make the message leave your gmail inbox.
This can either be a rule in gmail itself (been a while, do not know what forwarding rules they have at the moment) or to use a client that reads a mailbox and resend the messages.
This is what the Unix utility fetchmail does, but you can easily use the java mail package to access gmail using IMAP and then create new messages based on these which you then send though your own SMTP server.
If at all possible use existing code! This is a bit tricky to get 100% right.
I am developing a Mail Client in Java (JSP and Struts). I have successfully fetched Message header information and stored in my local Database (including Message ID and subject).
When the user views the mails, I fetch the message headers from my database and display them to user. Now when the user click a particular Email, I want to fetch the mail body and file attachments from the Gmail server, directly. I don't want to serially travel through all the mails on the Gmail Server.
I have done this earlier in PHP, where if I pass the message id and I can retrieve the details of that particular mail. Is there any similar functionality in Java Mail API? If not, then can anyone suggest me a solution to this?
You can use Folder#getMessage(int) for this.
Note that the zip file with the JavaMail API which you can download from their side includes a lot of examples in /demo folder, under each a basic(!) Servlet which shows a simple mailbox with this functionality. You may want to build, refactor and expand further based on the simple example.