I have some automated functionality built into my web app that sends email daily to remind customers of appointments etc. Basically I use an auto scheduler that starts each morning at 7 am, checks the database for customers that need to be emailed, and sends the messages. This is great, but beyond actually sending the email I am completely in the dark.
Can I somehow verify that an email address is actually a real email
and the email has been successfully sent?
What about checking for messages that were delivered to a spam folder
of some sort?
Diving even further...I know there are email services out there that
can provide statistics based on the amount of people who actually
opened the email. How do I check for this sort of thing?
My understanding is (at least for my first question) that I need to check the sender email address for returned or undeliverable emails and deal with them accordingly, but how do I do this programatically with Java? Do I need to implement another automatic daily process that checks an email account for undeliverable emails, handles the error, then removes the message? I assume that because of relay servers etc, an undeliverable error will not be available immediately because of relay servers etc.
I understand this is a slightly vague and loaded question so i'm not necessarily looking for a complete solution, but more or less some advice that will help me get started. I'd rather not use an external service.
Emails are usually fire and forget, so there is no standard way of tracking them down. Having some third party send emails might reduce the chances of your mail getting sent to the spam folder, but sometimes, the mail client seems to learn what emails you delete without even reading and starts trashing the emails immediately.
That being said, you can take a look at this and this previous SO threads. Depending on the content of you mail, there might be some possibilities for you to get some sort of response back.
As for being able to check which email is valid or not, you might consider using some sort of activation mechanism. You basically send them a mail and in it you include a link to which the user will have to navigate to activate some sort of service. If the user activates the link, than you know that they have access to the given email account.
Related
I'm working on a project I'm Java with regards to outlook.
Here I'm able to do all the functions like Read a mail, write a mail, reply to a mail etc...
But now we've been thinking of taking it to the next level.
Our plan is as below.
We have an email address like info#myDomain.com, when ever an email is sent to this address, I need to reply them. Here basically customers send an email asking for some data, and we've the data available in our portal, and we just need to send it.
The response would be Like thank you for contacting us, we will get back to you soon. Mean while please look into this {URL}.
And this has to be done automatically when ever there is an email hit to this particular email address.
Couple of questions:
- should my machine be on the whole day to get this thing done.
- is there a way that a Java application can automatically monitor my inbox to see for this case match.
- Also, can I have this running in the bg.
Can someone please point me into the right direction/approach where can I can start working on this task.
Thanks
when ever an email is sent to this address, I need to reply them.
For this you need to monitor your email account fro incoming emails. Here is one of the way to do this
The response would be Like thank you for contacting us, we will get back to you soon. Mean while please look into this {URL}.
Once you receive an email (using above email monitoring approach), you need to call a method that sends the reply with above format
And this has to be done automatically when ever there is an email hit to this particular email address.
Above two steps accomplishes this task.
should my machine be on the whole day to get this thing done
Basically, you will need an application server (like tomcat) where your above java program is deployed. So, yes this server needs to be running and available all the time.
is there a way that a Java application can automatically monitor my inbox to see for this case match
Check point 1
Also, can I have this running in the bg
You can run tomcat as a service in windows (more info). It has many advantages, automatic startup on boot being the one. Similar implementations are also available for other OS.
So, in short, this can be accomplished. It is bit complex but not much difficult. Cheers
[I have looked at all the questions related to this topic on SO but neither of them seems to explain the behaviour I am seeing].
I have two projects A (3-4 months old) and B (0.5 month old) and both use a common class to send email on Google App Engine. Both projects are currently running in the free quota.
When I invoke the common Emailer class from Project A, the email gets sent; invoking from B does not produce any errors in the log file (the logs show correct information in email fields), but the email never arrives at the recipient address. I have checked Spam folder/label and even searched entire mailbox for mail from:appspotmail.com (see below) and nothing.
I have verified that for each email sent, the email quota on Developer Console (at console.cloud.google.com/appengine/quotadetails?project=project-b&moduleId=default) registers another recipient, so obviously Google code is being invoked correctly (the email in question is for the reset password, so has only recipient).
I tried sending as admin#mydomain.com (admin#mydomain.com has been added to list of Email API authorized senders on the settings page of app B) and also as admin#project-b.appspotmail.com and neither one works.
On project A so far I have always sent email as admin#project-a.appspotmail.com (where project-a is the id of my GAE app) and have never faced any issue of this sort.
What is going on here? Is there some additional setting I am missing out on?
NB: This probably doesn't have any bearing, but mentioning in the interests of completeness: the recipient email address is of the form myaccount+xyz#gmail.com instead of the more common myaccount#gmail.com. However, manually sending email to this address from within Gmail works, so that shouldn't be an issue.
Update 1
Based on suggestions here and things that I've tried since posting this question, here are some updates:
I set up an email bounce handler as suggested but it hasn't been invoked yet (as per the logs).
Maybe it'll be invoked after waiting 24-48 hours. Let's see.
Set up account with email simplename#gmail.com and exactly the same thing (i.e., nothing) happened when I invoked Forgot password functionality.
Changed sender email to admin#project-name.appspotmail.com (instead of project-id) and got an Unauthorized sender message in an exception.
This means that the other addresses I have tried have been authorized senders as I never saw this exception with them.
The best way to troubleshoot App Engine Email delivery problems is to Configure Email Bounce Notification. As Emails are delivered asynchronously, any delivery problems will result in a bounce to the specified sender.
We are doing one email campaign for our company, but while sending emails from our domain then its firing to the spam folder , whereas we want to fire to the inbox.
If anyone has its solution please share it to me
Do you realize that it is the receiving end that decides whether your email goes to the inbox, the spam folder or elsewher (cd. rules in Outlook and other email clients)?
There are about a million reasons your email campaign mails could consistently end up in spam folder, a few of them are:
the contents are spam-ish.
you are sending the emails with >20 people in the To: or CC: list
your SMTP box could be listed in various RBL's (more likely this would cause flat out rejects though)
I suggest you obtain one of the spam-marked emails and look at the header added by the various checkers along the way (usually X-Spam-* or the like) to figure out what goes wrong for you.
Cheers,
There are a whole bunch of techniques modern mail servers use to detect spam. Not all of them are about the content of the messages.
The receiver looks up the reverse-DNS of the sending server. If the reverse-DNS is different from the part after the #, then that's a big strike against the email.
Add an SPF record to your DNS record.
Start signing your outbound mail
I'm writing a program, that sends email messages and want to know when the receiver receives the email message I've sent to him. How can I do this using JavaMail API?
If I use SMTPMessage, how exactly to deal with the result after I've set the notify options?
SMTPMessage smtpMsg = new SMTPMessage(msg);
smtpMsg.setNotifyOptions(SMTPMessage.NOTIFY_SUCCESS);
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.
Ok, this is an old discussion, but:
I've found a simple and working solution here (link in spanish).
You just need to add one more field to the header of the message. To achieve this you must use method addHeader of Part class, implemented by Message class. This method receives 2 parameters, type and value of header.
To get confirmation you must add this header:
Disposition-Notification-To
And the value is the mail where we want to send the confirmation answer:
message.addHeader("Disposition-Notification-To","mail#example.com");
ATTENTION: be aware that, nowadays, a lot of mail servers like gmail are discarding this requests, so this will not have effect, but, if you are sure (like me) receiver server allows this, will work like a charm.
please see my answer here (when this questioned was asked about ruby on rails). Tis basically the same answer.
Email open notification - ruby on rails
There is another approach to finding out whether an email has been received or not, it's getting undelivered emails. I've seen a rather good Java implementation here.
They used javax.mail (for mail processing) and guava (for processing strings and collections).
Just add a dummy image with display set to none in your message.And set the src attribute of this image to the url you want to call
You can use SMTP message and request for a delivery status (I don't know if it's coming when the provider receive the mail or if it's when the user open the mail).
JavaMail don't support directly these feature directly and you have to read the RFC 3464.
I also find this thread with examples but didn't try it javamail
You can also look at websina
I am configuring my J2ME app to get an event from the push registry on receipt of an SMS.
Would I be able to access the SMS message, before it reaches the inbox?
I have read that messages sent to port0 of the mobile go directly to native inbox and we can't access it. Is there any way of diverting or even sniffing these messages so as to perform an operation on them from within the J2ME app.
According to this discussion, it is not possible to receive a SMS on port 0 using a MIDlet before it enters the inbox. And while I am not familiar with the
Wireless Messaging API, various other posts seems to indicate that you cannot access the inbox either (I might be wrong on this).
What I think you could do instead is to open a serial connection to the modem part of the phone and listen for an UR code (Unsolicited Response, "events") indicating
that a new SMS is arrived, read it and if it matches your criteria delete it (from the inbox, you still have your copy) using AT commands.
See the AT+CNMA command (New Message Acknowledgement) and similar in the standard (most mobile phone AT commands are by the way specified in 27.007).
For the following I have no idea if if even makes sense/is possible. I only mention it for completeness.
As for processing the SMS before it arrives in the inbox I think the
only option (without it having being sent to a specific port that you listen for) is
SIM application toolkit (which can do a hell of a lot of things), although that is way outside the scope of J2ME and highly obscure and highly un-trivial. Only follow this route if you are really, really desperate.