How to get mail delivery report in jsp - java

In my java project project I like to send a mail to group or to an individual user. I want to know whether the mail has to be delivered or not for sender. If the mail address will be wrong then go to the report.

There is no standard way of doing this that's accepted and honored across the board. I see that you have some options, though:
Add a header "Return-Receipt-To" with your e-mail address in the value. If the recipient of the e-mail has a client which honors this header, then a return receipt will be sent to you when the e-mail is opened. This is not reliable, mind you, as the user can always decide not to send the receipt, even if he has a client that supports it.
Add an image into your e-mail that loads from your server and put a parameter on the image that includes the user's e-mail address. When the e-mail loads, the image will load from your server. Write a script that collects the e-mail parameter and then delivers a blank image. This is also not reliable, however, as many mail clients prompt users if they wish to download images and they can always choose not to. Also, some (mostly older) e-mail clients do not support images.
Perhaps the most reliable way is not to include the message in your e-mail at all. Include only a link to a website where the message can be read, and include their e-mail address or a unique code in the link. This way, you know exactly who read the message. Of course, this has the downside that people aren't actually getting the message in their inbox, and they also may choose not to go to the website to read it.
Ultimately, I think you're going to have to come up with a creative solution to solve this problem, unless you're happy getting spotty results.
Please refer this Link

Related

Why Firebase Email Verification not working - Android Studio [duplicate]

I am new to firebase and I am trying to handle firebase user authentication in React.js. I did manage to create users with email and passwords. But, now I would like to send the user an Email link to reset their password.
My code currently look like this.
// This line of code belongs to the top
import { auth } from '../firebaseConfig'
//This part goes under the React component
<p onClick={async () => {
try{
await sendPasswordResetEmail(auth, // My Email Id)
alert('Password reset link has been sent to your email')
}
catch(err){
alert(err)
}
}}
>Forgot your Password ?</p>
However, I do not get any error messages and I do get the alert message that says "Password reset link has been sent to your email." Unfortunately, I didn't receive any email. Note that I have given my own email id as the parameter for testing purposes.
firebaser here
Did you check your spam folder? We recently see a lot of the emails from Firebase Authentication ending up in the user's spam folder or being marked as spam in a system along the way. This is being tracked in this status message on the Firebase dashboard and in public issue #253291461.
To reduce the chances of the messages getting marked as spam, consider taking more control of the email delivery yourself.
As a first step, consider using a custom domain with your project. Email that comes from a custom domain has less chance of being marked as span.
As a second step, consider setting up your own SMTP server.) for delivering the email, so that the emails are not being delivered from Firebase's shared infrastructure anymore.
While these steps are more involved, they typically will drastically reduce the cases where the messages from Firebase Authentication are marked as spam.
Full Guide Based on Frank's Answer
Firstly create a new email account you can use to relay the Firebase emails through the SMTP server with. I personally chose Gmail, but I tested with Outlook and it also works.
You can now find an SMTP server host that will work for your scenario. If you're sending less than 1000 emails per month you can find free and reliable hosts. I chose SMTP2GO's free option.
Now you've found the SMTP host, add the email address you've chosen as a single sender email (note that if you do own a domain, you can alternatively use that to send emails).
Note that you will have to verify the email, usually by your host sending a link to the email's inbox. Make sure to check spam.
Once verified, navigate to where you host allows you to add SMTP Users and add a new user. This will allocate an SMTP username and password.
Navigate to the Firebase console, and choose the Authentication option from the sidebar (within the Build product category).
Go to Templates → SMTP Settings and enter the details of your SMTP server. The username and password fields are to be filled with the SMTP user login you created in the step above.
It is better to use TLS, but I believe SSL should work too but it is untested.
Click save, and you're all set up - but there may still be steps to perform depending on your email provider.
Provider Specific Steps
If the emails are being sent to an account managed by Google you will have no issues with your emails being quarantined by anti-spam policies and it will work immediately.
If you are using Outlook, you will have a different problem on your hands. Outlook's built in defender will most likely have auto-quarantined your email under multiple policies - that bit is important.
These policies are likely to be both spam and phish policies. If you unblock one of them, the other will catch it and re-quarantine.
Unblock both policies for the email address, and test. You can see the status of quarantined messages in Microsoft 365 Defender app under Review → Quarantine. Please note that you will need to be an administrator to add global allow policies to your email accounts.
If this still doesn't work it is likely that your company has an additional external filter (as mine did), and you will have to add the IP's manually to the Tenant Allow/Block Lists spoofed senders tab.

Save email attachment's link in android database downloaded by javamail

I want to store all emails read by javamail so that next time only recent emails requires to download.All email fields are look simple to save in database except attachments.The bodypart of attahment returns inputstream instead of filepath.
My question is how to save attachment links for each email so that it can be download only when user wants.
I think you can achieve this easier: If somebody wants to download the attachment just reconnect to the server and search for the given email, then download the attachment. So you don't need to store a link or anything in the database. Searching for a mail can be done by using SearchTerms an example for that can be found here.
Attachments aren't files or links unless you turn them into files or links.
If you're writing a web user interface to email, you'll generally want to leave all the message data in the email server and fetch it from there when needed. Depending on your user requirements, you might want to copy the messages from a "remote" email server to a "local" email server.
If you're determined to store all this information in a database, you're going to have to decide whether to store arbitrarily large attachments as BLOBs in the database, store them somewhere else (in the filesystem?), or leave them in the original email server and fetch them on demand.
Your web application will need to "create" a URL that represents each attachment, and when it gets a request for the URL it will need to interpret it and find the attachment wherever you decided to store it. There's probably 100 ways to do this, and probably 90 of them are insecure, so be careful.

Java outlook integration

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/

Pending/Approved/Denied workflow security for Java

I'm have implemented a module for Java web application that users will need to request for them to access the secured data. It works like this: when users that does not yet have access clicks on a certain link, a request is made and is received on the server side. It now generates an email and sends to people who are "approvers". The email contain links on approving or denying the access of that user.
Approved Link:http://hostname/App_name?action=actionClass&approved=true
Denied Link:http://hostname/App_name?action=actionClass&approved=false
Now the question is, is there a better way to do this which also takes into consideration the security?
I did try to look for other posts that are related to this but the results don't seem to be touching on this regard. If there are any that I have missed, I would appreciate if you can also point them so I can revise the question.
Thanks in advance
I'll assume that you are authenticating the users when they click on the given link, because otherwise it's just bad mojo.
You can have some privileges assigned to that user and check that to see if you are going to allow the approve or not.
That depends on how you are sending out the email. Assuming you are doing it client-side, then a user could intercept their own approval link, which clearly you don't want.
A better way (assuming you aren't doing this already) would be to send the user information (via HTTPS of course) to your server and then have the server generate and send the email. This way no one has access to the approval link except those emailed by the server and those in control of the server (you hopefully).

Best way to send an E-Mail from a java Application

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.

Categories