Issue With Receiving Keycloak Email to the Clients - authentication

I have a fully functional Keycloak setup with verify email and then update password features enabled. I have tested multiple times and the mail sending part is working perfectly. But some clients reporting that they didn't receive the registration mail. This maybe due to their firewall, spam filter and so on, now I want way to check whether the email has sent from my system or not. Logs won't help at all, cannot find anything related to sent mails in logs.

Related

Is there a way to test verification emails using Karate?

The problem I have is that I need to test if user verification is working. We generate a verification token, and an email is sent to the user. Whenever the user clicks on it, it checks if the verification token has expired. I've tried mocking this, but it just won't work. We have an endpoint to verify a user, but we still need the verification token, which is not available on any endpoint.
I think this article may help you: https://www.testingexcellence.com/automated-api-testing-emails-karate/
To summarize:
use the API at http://qamail.ala.se/ to create a test mailbox
initiate the flow that sends the e-mail
use the API to "read" the e-mail and grab the token
EDIT: looks like the link is dead. but you should be able to find similar offerings on the internet. since the source-code seems to be available, it may make sense for you to host this e-mail server somewhere so that it can receive e-mail from whichever system is the sender

Sending email with Javamail from a script without a password

I have a script that runs a Java program to run some tests every night. It needs to email out the results of the tests, using JavaMail and a Google apps account.
How do I authenticate with Gmail (through the JavaMail API), without storing the password on the machine that runs the nightly tests? Can I get some sort of an Gmail authentication key that is valid for, say, a month? I don't mind refreshing the key every month, but don't want to keep the password on the test machine.
Google email accounts cost money so I would prefer not to create a new account just to email test results out.
I haven't tried that myself but you can try to send in the mail using the MX servers of googlemail. Currently these are
~ $ host -t MX googlemail.com
googlemail.com mail is handled by 40 alt4.gmail-smtp-in.l.google.com.
googlemail.com mail is handled by 10 alt1.gmail-smtp-in.l.google.com.
googlemail.com mail is handled by 20 alt2.gmail-smtp-in.l.google.com.
googlemail.com mail is handled by 5 gmail-smtp-in.l.google.com.
googlemail.com mail is handled by 30 alt3.gmail-smtp-in.l.google.com.
These are the servers responsible for inbound mails from the outside world, it's plain SMTP without the need of authentication (but you can try to start TLS to make the transfer more secure). There might be checks though, that prevent you from delivering mails to these servers (dyn-IP-checks, SFP, etc.) which is why this might fail.
If you don't want to send to a Google mail address you can try the same thing but replace the MX server of Google with the one responsible for the mail address you want to send to. Just use above call with the different domain or use one of the search results for "mx lookup" if you don't have that as command on your system.

Can't recieve incoming mail with Mailgun

I'm trying to set up inbound mail with mailgun. I want to receive email at support#mydomain.com. (changed for privacy)
All Mailgun's DNS checks pass.
I have a route set up. The expression is match_recipient("support#mydomain.com") and the action is forward("me#gmail.com")
When I use the route testing tool it correctly matches my route.
But when I send email in real life to support#mydomain.com, I get a failure notice. The error message is:
Your message cannot be delivered to the following recipients:
Recipient address: support#mydomain.com
Reason: Remote SMTP server has rejected address
Diagnostic code: smtp;550 5.7.1 Relaying denied
Remote system: dns;mxb.mailgun.org (TCP|17.172.80.96|58312|52.5.239.85|25) (ak47 ESMTP ready)
What step am I missing here?
I know this is over a year old, but since I spent 4 hours trying to figure this out, I will share my solution:
My mailgun account wasn't verified. I saw someone suggest this but I figured they just meant that I had to verify the address I was forwarding to. Nope, when I logged it today I saw a banner at the top saying click here to resend your verification email. I did that, it went through a text message verification process, and all immediately started working!

Bugzilla Gmail SMTP failed to authenticate

I have a bugzilla 4.4.2 installation. I want to use the gmail smtp service to send email from my application. I have applied these blogs
http://www.dawood.in/bugzilla-alerts-using-gmail/
http://prasadlinuxblog.wordpress.com/2014/02/26/975/
Applied the patches mentioned there. I configured the mta parameters in Bugzilla admin section with my gmail user name and password. Note that, I am not using two step verification in google account. So after all these, the application fails with an Authentication Error. It says the following message
There was an error sending mail from 'myemailaddress#gmail.com' to 'receiver#gmail.com': Could't set FROM: 530 5.5.1 Authentication Required. Learn more at at lib/Email/Send/SMTP/TLS.pm line 49
Cant really figure out whats going wrong here. I found one similar question https://stackoverflow.com/a/8533805/3692283 but I am already following the solution mentioned there.
Check whether the email entered at the SMTP user is still valid. If the password is no longer valid, then it cannot be chosen as the SMTP user name.
The SMTP password is the email's password.

Get SMTP automatically

I am using code to send email through SMTP that is given manually. I wish that user does not have to give the SMTP. My application should get SMTP automatically and use that.
Can I know what is the SMTP of the current ISP, with which my client is connected?
Thanks
Furqan
You could try to read that from the user's e-mail clients; AFAIK each e-mail client (e.g. Outlook, Thunderbird, Opera, Eudora) stores the SMTP server settings differently; so probably look for the most common ones (Thunderbird, Outlook, ?). Also, some people only use web-based e-mail (esp. gMail users), so they may not even have a SMTP setting stored anywhere.
Note: nosing around in other apps' settings can be seen as borderline spyware, so I suggest to get permission from the user before you start digging in their app settings.
No, I don't think this is possible. What you could try is to look if the SMTP server is configured in an other program. E.g. under Windows in Windows Mail. However, I don't know if it's worth the trouble. Today SMTP auth is common and probably no other program gives you access to the users credentials so you have to ask the user in all cases.