I'm not even sure of the right terminology to ask the question, but here is what I'd like to accomplish. I've seen it done on sites such as craigslist.
My website has multiple users. When a user registers with the site they provide an email address (gmail, hotmail, whatever)
users are allowed to message each through the website
When Bob sends a message to Mark through the website, Bob and Mark never see each other's email address
Bob's message (bob#gmail.com) is sent via email to Mark (mark#abccompany.com)
-Mark receives the email. The from and reply-to looks something like this, so Bob's email address is never seen.
bob smith (d8d8cdd8677031a983148db1823f9b94#reply.mydomain.com)
there should be angle brackets there but I can't get them to display properly.
Mark replies to the email, and the reply email has the to address as:
bob smith (d8d8cdd8677031a983148db1823f9b94#reply.mydomain.com)
The mail server decodes the reply to address, figures out who sent it and where it's going, and sends a reply to bob, hiding Mark's real email address.
What is this even called? Is this a simple manipulation of the message headers to do the hiding? I need to come up with something similar in my grails app. A user never sees the real email address unless one user puts it in the actual message body 'hey my real email address is bob#gmail.com, email me there direct.'
Does anyone know if Amazon's SES service supports this type of thing?
Transactional email is one of the correct terms that describes this service.
Amazon does not provide this type of service (as of this writing). If you google 'transactional email api' there are several services that popup which provide exactly this type of service.
Related
I have the following use case in my app:
When a specific event happens in the app all interested users should be notified by email. Then if a user replies to the email, his reply should be shown in the event page in the app.
My initial idea was to create a temp mail alias of the main notification email every time when an event happens and send the notification email with that alias set in the Reply-To header. Then if someone replies to that mail by using the alias (let's say csa123423#mydomain.com) I can figure out which event this reply refers to.
It turned out that Spring's JavaMailSender doesn't provide a way to use aliases, so I tried with Gmail API. As far as I understood creating a Gmail alias means actually setting an already existing email in your domain as an alias for another already existing email in that domain. So the Java code to achieve this using Directory API and Gmail API would look like this:
User newUser = new User();
UserName userName = new UserName();
userName.setGivenName("xsd");
userName.setFamilyName("ewrewr");
newUser.setPrimaryEmail("bbb34262bb45#mydomain.com");
newUser.setPassword("12345");
newUser.setName(userName);
User result = directoryService.users().insert(newUser).execute();
SendAs sendAs = new SendAs().setSendAsEmail("bbb34262bb45#mydomain.com").setReplyToAddress("bbb34262bb45#mydomain.com").setDisplayName("My name").setTreatAsAlias(true);
SendAs sendAsResult = gmailService.users().settings().sendAs().create(user, sendAs).execute();
MimeMessage emailContent = createEmail("mymail#gmail.com", "bbb34262bb45#mydomain.com", "Test from app", "Test body");
Message message = createMessageWithEmail(emailContent);
message = gmailService.users().messages().send(user, message).execute();
But as far as I know there are some limits on the number of accounts you can create per domain/account and also Google would charge more for this.
Is there another easier way to create aliases in Gmail? Or is there another approach to achieve the desired functionality (linking mail replies to application content) without using mail aliases?
Try leveraging '+' functionality given by Gmail for creating temporary aliases.
The basic idea is if my email id is xyz#gmail.com, I can send/receive an email with xyz+1#gmail.com or xyz+anything_here#gmail.com and it will work like a charm.
You can utilize this by keeping the alias/unique-id after the '+' in the Gmail id and then parse this alias easily in your application.
I making one application that can send different email, but the email address depends of the user. I'm using mailjet to do this, after reading the doc, it's seem that i have to add every email for have the right to send email from this address, but this address are not generate by me (they are gmail, toto, etc)
I already use the Java API of mailjet to add user, and this part is working fine
But my problem is when the validation email arrive, and the person follow the link, mailjet ask to login, but he do not know what to do, because normally is my own account, i only what to add their email address to have the right to send email with them.
So the question, is how i can add email address (from gmail, yahoo...) and activate the user, without the login part.
Thanks for having choosen Mailjet to power your email!
I believe the right setup for you would be to use the Sender header. It will allow you to send email from a unique (or multiple, depending of your setup) pre-validated sender email addresses while setting the From email header to the email you want to send the email from.
In your recipients Inbox, it will display as foobar#gmail.com via notifications#mycompany.com, indicating clearly to the recipient that you're sending on behalf of foobar#gmail.com. This way, you won't be forced to validate each email address, just ones you'll
This is a very common setup for resellers and platforms sending a lot of personalised email.
In order to achieve this, please contact our [support team](https://app.mailjet.com/support] with a reference to our discussion here so they know what we're talking about. They'll guide you to the implementation it.
Hope it helps,
Best.
Ok, how can Javax.mail check if an email is existing?
Let say I sent a message from a#cc.com to b#cc.com using Javax.mail. b#cc.com does not exist but Javax still saying that it sent the message OK. That is just like you email to a non-existent email in Yahoo mail or Gmail, even the destination email is non-exist, you still can be able to email it, & you only know that destination email does not exist after many hours when Gmail or Ymail returns a "failure recipient sending" or something like that.
Someone said that we can use MX record but they did not clearly how to use Javax to achive that. I doubt that solution.
Can you find a solution for it?
You will not be able to make sure that the address exists. Due to the distributed structure of the internet, the knowledge of whether an address exists is not available at one central point.
What you could do is check whether the domain to which the email is sent (cc.com in your example) exists and therefore if there's a chance of your email arriving. The idea of using the MX record is basically this; you can check which server would be responsible for the delivery of your email.
Refer This Question and Oracle Article To solve your problem.
You can get detailed delivery report whether your email is sent or not to correct email id. There's exception, if wrong email id is entered and it is available it will to it.
I have a very special requirement
I am using Java Mail API to access a user's Inbox. You can say its like a service inbox for complaints. User registers a complaint by sending an email to this address. I fetch every email from Inbox and create a new complaint. My problem is that I don't want to create unnecessary complaints for reply or forwarded emails. Is there a way to find out that.
Most email clients add Re: or Fwd: to the subject line, but I wouldn't rely on that to determine whether an email is a reply or forwarded text; for example, a German mailclient might put Betr.: in front of the original subject.
Instead, you might want to look at the In-Reply-To: header and/or the References: header. See RFC 4021 for detailed information on those headers.
You can retrieve the headers from a Message by calling the getHeader(java.lang.String) method.
Reading the email header might help, see http://javamail.kenai.com/nonav/javadocs/javax/mail/Part.html#getAllHeaders(). In case of replies, the message header would include:
In-Reply-To: Message-ID of the message that this is a reply to
In case of a forwarded message, selected headers might be preserved. Not as straight-forward as the previous case, but it might still be possible to determine if it was a forwarded message. Refer to http://en.wikipedia.org/wiki/Email_forwarding#Manual_client-based_forwarding for details.
I have an online form that allows users to email a complaint to the company. To test it I have used gmail smtp as my host. I have no problem receiving the message to the designated email account when the sender is also a gmail but I want the "From" to not be limited to just gmail accounts. It appears that smtp is only good for sending emails from the same server?
Example: My form works great if the from is abc#gmail.com and the company email is company#gmail.com.
However if xyz#yahoo.com is entered for the sender, the receiver company#gmail.com never gets it.
Any help would be greatly appreciated. I can provide my code as well if that is needed.
Your problem is a common security restriction when using SMTP. Outgoing SMTP email can only contain a "mail from" address belonging to the sender. If you break this rule, your email may be considered SPAM.
The following will allow your recipient to reply to an alternate address.
Properties properties = new Properties();
props.put("mail.smtp.from", "abc#gmail.com");
Session session = Session.getDefaultInstance(props, null);
MimeMessage m = new MimeMessage(session);
m.addFrom(InternetAddress.parse("xyz#yahoo.com"));
m.setReplyTo(InternetAddress.parse("xyz#yahoo.com"));
See also
http://www.mkyong.com/java/javamail-api-sending-email-via-gmail-smtp-example/
http://www.openspf.org/Best_Practices/Webgenerated
Well you will have to own the other email as well as set it to work with gmail,
Check here for more details.
It's probably better to send the message to your company's mail server using the identity of the user who owns the application on the server, and include the information that the customer provides in the online form as data in the message you send. The message won't look like it came from the customer, but then it really didn't come from the customer since it wasn't sent using the customer's mail server.