JavaMail without a Sender - java

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!

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.

How to configure an app on Google App Engine to Receive Email on any email address?

As we know if we want to enable our app on App Engine to receive emails, we need to first configure an email address of the format string#appid.appspotmail.com in web.xml file. However, I wanted to know if it is possible to use an email address of the form string#domain.com which can be used to receive emails for the application. Like you can map you appid#appspot.com to your own domain, and it works fine but wanted to know if it is possible do it for emails also somehow.
Just direct your mail server for domain.com to forward string#domain.com to string#your-appid.appspotmail.com or your-appid#appspot.com. The inbound email processor doesn't care what the original "to" address is -- it will process it regardless. You have access to the headers programmatically, so you can decide to treat it differently depending on what email it came in through, if you want.

How to send emails to inbox folder from my webdomain

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

How do you send messages from a different address using Gmail and Java?

I'm using Java to send messages from Gmail with Apache Commons Email, but it seems like it doesn't allow me to send messages from an address different from the one that I use to authenticate.
How do you send messages from a different address using Gmail and Java?
Basically, you are looking for an SMTP server which will let you send a message by spoofing the From MIME header. Well, if you can't find a hosted SMTP server online, you can always install one locally on your box. This will allow you to modify the email address of the sender to make it appear as if it is coming from gmail.
As far as I'm aware you can't. That is what is called relaying. Relaying is what the spammers use to send mail pretending to be whoever. Its a security hole. If you want to send as someone else you need to create another account.
How do you send messages from a different address using Gmail and Java?
For gmail, you most likely can't ... for obvious reasons.
In the Java case, whether you can or can't do this depends on the mail server that your Java application connects to. A mail server typically can be configured to allow this, but it has obvious issues so a responsible mail server admin is not going to allow this, except in controlled circumstances.

temporary email address concept

I would like to do a similar concept on how the site craigslist is able to create a temporary email address for a seller in order to hide the seller real email address (to keep it private) when someone wants to contact the seller. If you send and email to the temporary email address, it will actually go to the seller’s real email box.
I would like to know how this is done? Do I need to install an email server? What do I need to actually implement this ?
Any suggestions or reading material would be great.
You have a lot of things to learn if you're asking this broad a question.
Install an SMTP server such as Postfix
Configure aliases that forward mail to the "real" destination
Have your application update the alias configuration whenever you need to create or delete an address.
How to actually accomplish all of this is way beyond what SO is for.
You would need to have a "catchall" mailbox so that all e-mail would go to it. Then you need to write a routine to check the emails and parse the "to" address, matching it to the real address in your database.

Categories

Resources