Im searching all day online to find an answer to this issue im having during my selenium testing.
Im trying to test if is it possible to test my sites reset password functionality while using a dummy email server. I understand I may have to use javamail (I think) for this but wanted to know if anybody knew of any possible way to maybe use a dummy email server like mailtrap or something like that, select the reset password link, reset the password and log back into my account using the new password??
Im using selenium and java for my tests.
PutsBox
seems to be the anwser to your question. It's a great, easy to use tool for testing your emails via GUI.
How does this piece of joy work?
Send an email to whatever-recipient-you-want-to#putsbox.com, give it a few seconds (don’t blame PutsBox, email delivery services may take a few seconds) then check https://preview.putsbox.com/p/whatever-recipient-you-want-to/last, voalá, it will respond with your email content. You can also append .json to that URL to get the JSON representation.
No sign up required, PutsBox is free and open source.
Basically - register your User as you would with an email such as emailAddress#putsbox.com, then you can check the newest (very important, only the newest) email sent to that account by going to https://preview.putsbox.com/p/emailAddress/last.
As it is a webpage you can use Selenium and check all the elements you want in that email.
Related
I have a small app with a working LoginActivity. I now want to develop a Fragment for this activity that will handle helping the user to create a new password if it has been forgotten. I have seen some people using PHP/MySQL for this, but I was wondering if it is possible to use Java/SQLite to accomplish the same goal?
Expected functionality:
User clicks forgot password link
Sent to ForgotPass_Fragment which asks/verifies a user's email.
If it is a valid email, email the user the code/new temp password
I guess the real question is if I can use Java to send an email to the user with the newly generated info rather than using PHP or some other language? Would something like this be the best practice?
Assuming your password recovery information is stored on a server, you will need to use some sort of server-side (PHP, or Java, or whatever) webservice to server the "recovery email".
If for some reason you already have the users password information on the phone (which would be a really bad idea) you could use a local Android Java call to respond with the information.
Bottom line, you will need a webservice to provide the password info the user.
I have to send an email from IntentService. My data is mostly the backup from a phone. I am using smtp.google.com + javamail.I can use a gmail account and send data through it.(http://www.oracle.com/technetwork/java/javamail/faq/index.html#gmail):
From my point of view the problem with this approach is that my app uses the gmail account and sends data via my account. All personal data would go through one my account. Question#1 - Is it a good approach to do it?
The gmail api uses OAuth 2.0. And I have to store my client ID in some place of my program. I read that it is impossible to restore login/password from it. This token has validity. Question#2 Is it possible to use this token for reading or deleting something from gmail account until it is valid?
For all examples of my app would be the same gmail account. This think bothers me sometimes, because if something happens with gmail account I will not be able to do anything.
Question#3 Is it worth to use services like https://www.mailgun.com/ or maybe to create at least another gmail account and to use them both?
Only if you're the only one using your app.
Yes.
Email is probably not the right solution to your problem. But without knowing more about the problem you're trying to solve and what your requirements are, it's hard to know what to suggest instead.
I have a program that must 'prepare' emails for me. When the email is prepared, it should show in outlook (or an other email client - default user mail client).
I have used the Desktop.getDesktop().mail approach, but I'm very limited with the options. (I cannot set the high importance). An other option I've tried is JavaMail. But here the mail will be send instead of opened in the email client. (same for Apache POI).
An other option I've considered is to write a .msg/.eml file and open it, but this must be done manually (via java I get a 'file not found' error or an error regarding privileges).
Does anyone know other options or other approaches I might have missed / overlooked?
You can make use of moyosoft's connector to access outlook functionality from java. Please refer to below url's for more details on this.
http://www.moyosoft.com/joc/
http://www.moyosoft.com/joc/getstarted/
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.
Perhaps this kind of question comes under not to ask category but for the sake of application I have to ask.So pardon me.
At the time of Log in,I found that(suppose)If I am unable to remember my password,then I have to put my email-id then an auto generated reply come from that's hosted site with
a new link for generating another new password or
simply sending password(that means password isn't encrypted,I guess) in reply.
watching the source code it's hard to predict,but I want to know(if they are using jsp) then which protocol is used for this auto generated mail what are the other things to remember to achive this, while I'm also making an application for auto generated mail.
I have done this using javax.mail api in java
google for sending mail using java...
define content of mail in template or resource file and send mail whenever user clicks on forgot password link.
It is using SMTP protocol only.