How to send emails to inbox folder from my webdomain - java

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

Related

My POP3 sever is sending me both sent and received messages - how to conclusively distinguish

From a search, I can find a lot of similar questions to this but all of them seem as far as I can tell to have either been misunderstood or to not be quite the same as this question.
Presumably (maybe not but it seem unlikely) an email process/server knows which emails it holds a record of because they "arrived" and which it holds a record of because someone used SMTP or similar to tell the server to "send" an email out.
If a POP3 client retrieves lots of emails from the server and (we know from observation that) some of those emails are emails that the server was told to send out and some are emails it received, then is the pop3 server contravening the protocol because it provided for download, emails which were conceptually NOT in the "Inbox" or is it at liberty to send what ever it wants since POP3 has NO concept of folders and emails are emails.
Either way, is there an easy and robust way for the client to distinguish between these emails? Or is checking the from field against the account the best on offer? I believe pop3 messages support flags, some POP3 apis do, but perhaps servers are not obliged to make any guarantees, plus I don't see a very clear description of their meaning, so I don't if they can be consisently used to distinguish.
For implementation my preference is Java and com.sun.mail.pop3
I realize there is IMAP, but at this stage I'd like if possible to make a very small change to POP3 client implementation and look at switching to IMAP another time.
Thank you.
POP3 is a protocol to get the messages of your inbox. To send messages you use SMTP protocol.
In my understanding you contact the server using SMTP and deliver a message to the server. The server then delivers this mail to the corresponding target mail server and stores the message in that inbox.
On the other side you contact your own inbox using POP3 to receive the message that are stored in your inbox.
Thus there never should be any conflict between ingoing and outgoing emails as these are two different things and the servers supplying pop3 and smtp for your mailbox can be two total different servers on total different locations. Thus, within one mail server inbox and outbox should be two different storage locations.
"Conclusively distinguishing" depends on how/why the messages are being seen in POP3. A best effort type solution, though, would involve substring scanning the From field looking for what was provided in the USER command. If a token based authentication mechanism is being used, then you'll need to get an email identifier from whomever issued the token and look for that in From header.
As background, a basic concept in POP3 is called the "maildrop". Most people equate that to "Inbox" in IMAP terms, but it's not necessarily the same. For example, a message filtered at deposit time into a custom folder might show up in POP3's maildrop even though it doesn't show in Inbox via IMAP or Webmail. What goes into the maildrop and is therefore seen in POP3 can vary from implementation to implementation.
If a user only has POP3/SMTP and Webmail as their choices, they'll sometimes BCC themselves on sending to make sure a copy exists somewhere on the server so that they can access it via Webmail if needed. That's because very few SMTP implementations automatically save the message to the user's mailbox, and POP3 has no mechanism for saving the message anywhere but local to the user-agent. For those SMTP servers that do automatically save sent mail in the mailbox, they might just put it in the maildrop when it comes to POP3 servers.

Can't set the email sender in JavaMail - Spring [duplicate]

I want to send an email from A to B, with HEADER and CONTENT through gmail.
How to do that by PHP?
I've specified the FROM (from#example.com), but when I receive the email, it's still from my gmail account (abc#gmail.com).
$mail->From = "from#example.com";
$mail->FromName = "Mailer";
$mail->AddAddress("abc12#163.example", "Josh Adams");// name is optional
$mail->AddReplyTo("abc12#qq.example", "Information");
How do I change the FROM part?
The short answer - you can't.
Google rewrites the From and Reply-To headers in messages you send via it's SMTP service to values which relate to your gmail account.
The SMTP feature of gmail isn't intended to be an open or relay service. If it allowed any values for the From header, it would significantly dilute Google's standing with spam services, as there would be no way to verify the credentials of the sender.
You need to consider alternatives. How are you planning to host your script/application/website when it's finished: virtually every hosting solutions (shared/vps/dedicated server) will come pre-configured with an email transfer solution: be it sendmail or postfix on *nix, or IIS on Windows.
If you are intent on using gmail then you could:
Setup a dedicated myapp#gmail.com account
If you own the domain you are supposedly sending from, use the free gmail for domains, and setup a myapp#mydomain.example account.
====
Edit June 2015
It was suggested that GMail does allow sending via different addresses. As far as I can tell, this is for sending via the GMail wep app, and utilises your existing external SMTP server, which is not relevant to the original question.
====
Edit Nov 2013
Seeing as this is still getting a trickle of votes. A quick update.
Google have withdrawn their free GMail for domains. There are plenty of other free services around. One of note is Mandrill - a one-to-one email service intended for transactional emails (e.g. ecommerce orders etc.). It's ran by MailChimp, who pretty much know all there is to know about sending email at volume. They also give you 12k/month free, which is rather nice.
This question and correct answer may be relevant:
When using Gmail for SMTP, can you set a different "from" address?
Gmail requires you to validate From addresses before sending mail as that email address. So you need to add a new sender in your personal gmail account and validate it.
Doing so will allow you to authenticate with youremail#gmail.com and send email from from#example.com
Unlike everyone else, I'll take the plunge and make the assumption that by letters you mean emails...
But I'm not sure what you are getting at when you mention that it should include "Headers and Content". Do you want to forward emails? Do you want the emails from A to appear as though they came from B's gmail account in the headers? Are you building some sort of gmail client?
The easiest way to send an email with PHP is with the mail function. This example comes straight from their documentation:
$to = 'nobody#example.com';
$subject = 'the subject';
$message = 'hello';
$headers = 'From: webmaster#example.com' . "\r\n" .
'Reply-To: webmaster#example.com' . "\r\n" .
'X-Mailer: PHP/' . phpversion();
mail($to, $subject, $message, $headers);
If you want the headers to appear from A's gmail and not to simply change the from/reply to part, you'd have to use gmail as the SMTP server. I don't know if you can set that at the script level.
The answer above are not quite correct.
You are definitely able to specify any senders as long as you own the other email address.
As the help page explains:
On your computer, open Gmail.
In the top right, click Settings.
Click the Accounts and import or Accounts tab.
In the "Send mail as" section, click Add another email address.
Enter your name and the address you want to send from.
Click Next Step and then Send verification.
For school or work accounts, enter the SMTP server (for example, smtp.gmail.com or smtp.yourschool.edu) and the username and password on that account.
Click Add Account.
Once that email is added successfully,
you can send email on the behalf of the new email address in gmail.
Google will not rewrite your from email in this way while you're sending email via Google SMTP.
You need to go to GMAIL settings and add new alias.
You will be asked SMTP information, which is basically useless, since you are using SMTP to send email, BUT the catch is that if your alias is on Google Suite domain it will be added just with simple email confirmation!
Once you have the alias there, you can change "From" header in your SMTP email.
NOTE: You cannot change the "From" address to whatever#dude.example, that's just how Gmail works and is the reason it's trusted.
If the reason you want to use gmail is because you don't want to set up an MTA (the reason you stated in a comment to this answer), you have 2 options:
If the web server is at your
home/work place; use your ISP's
smtp-server
If the web server is at a dedicated
hosting center, ask them what
smtp-server to use.

JavaMail without a Sender

So the question I have is one regarding JavaMail. I want to send an email to different email addresses, but I want the sender to be something like "noreply". However, I can't seem to do this because JavaMail needs an actual email address on both, the sender and the receiver, for it to work.
I could create my own domain and SMTP, but that seems annoying. Anybody have any suggestions? Thanks in advance.
If the SMTP server does not do any checks itself (such as checking that the From address you are sending from actually exists and matches the domain name) JavaMail allows you to put whatever address you want. If your SMTP server allows it you can even spoof email addresses of other people easily. So you could set your From field to president#whitehouse.gov if you want without problems.
Just set it to no-reply#something.com to test it out. However you should put a good domain otherwise your emails might get marked as spam by spam filters. Showing the recipients where the email is actually coming from is also a good idea!

Catching Undeliverable or Spam Folder Email

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.

How can I recieive confirmation for delivered email with JavaMail API?

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

Categories

Resources