Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to route mails from gmail to mailgun?

I have just started using mailgun. I am facing an issue. Lets say my domain is test,I have done this

[email protected]> [email protected] --> [email protected]

SO I am able to route incoming msgs coming to my gmail account, Now I want if I reply from gmail account to the particular user it should appear like that it is sent from [email protected].

[email protected] --> [email protected] (appeared as it is sent from [email protected])

is it possible???? Language:- Java

like image 858
Pulkit Avatar asked Feb 08 '14 16:02

Pulkit


People also ask

Can I use Gmail with Mailgun?

1) Go to settings in gmail 2) Click on Accounts 3) Send mail as: Click on Add another email address you own 4) Provide the email id you wish to appear as "Sender ID" 5) provide SMTP connection details which you can see once you login to your mailgun account and click on domain.

Can I route email through Gmail?

You can optionally set up a catch-all address for these misaddressed messages. If your organization uses an on-premise mail server for storing and sending email, Gmail processes incoming messages first. Gmail filters for spam and other problem messages, then routes messages to the on-premise server.

Can you receive emails with Mailgun?

You can define a list of routes to handle incoming emails and prioritize the sequence of their execution. Each route consists of a filter expression and an action. When a message is received, Mailgun evaluates the filter expression against it.


2 Answers

Thanx to @Andersen, I got the solution. In gmail we have option in which we can change our mail id and make it look like it is coming from some different id while replying.

1) Go to settings in gmail 
2) Click on Accounts
3) Send mail as: Click on Add another email address you own
4) Provide the email id you wish to appear as "Sender ID"
5) provide SMTP connection details which you can see once you login to your mailgun account and click on domain.

enter image description here

6) Save the settings, now when you are replying we can change from id to our custom domain id.

Enjoy

like image 189
Pulkit Avatar answered Oct 06 '22 05:10

Pulkit


You need something to make the message leave your gmail inbox.

This can either be a rule in gmail itself (been a while, do not know what forwarding rules they have at the moment) or to use a client that reads a mailbox and resend the messages.

This is what the Unix utility fetchmail does, but you can easily use the java mail package to access gmail using IMAP and then create new messages based on these which you then send though your own SMTP server.

If at all possible use existing code! This is a bit tricky to get 100% right.

like image 40
Thorbjørn Ravn Andersen Avatar answered Oct 06 '22 06:10

Thorbjørn Ravn Andersen