5

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

abc@gmail.com--> support@test.mailgun.org --> myAccount@gmail.com

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 support@test.mailgun.org.

myAccount@gmail.com --> abc@gmailc.com (appeared as it is sent from support@test.mailgun.org)

is it possible???? Language:- Java

Pulkit
  • 3,953
  • 6
  • 31
  • 55

2 Answers2

9

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

Pulkit
  • 3,953
  • 6
  • 31
  • 55
  • does it work i mean in hotmail do you appear as website i did this and both my personal and domain email were showing up – Muhammad Umer Jul 19 '14 at 03:45
  • @muhammad umer: yeah it worked, when i was sending mail through gmail they appeared as admin@customdomaim.com instead of mine gmail id – Pulkit Jul 22 '14 at 19:49
  • when i did it my email appeared as: From: `my@gmail.com via support@company.com`..I'll try one more time. – Muhammad Umer Jul 23 '14 at 00:54
  • Muhammad let connect. We will do a teamviewer and see whats the probelm. Let me know if its ok for u – Pulkit Jul 24 '14 at 09:00
  • i found out the problem when i was configuring it in gmail settings there is small checkbox checked that says use this email as `alias`. Which is exactly not what i wanted so...yea thanks. I was convinced there was no way to do it, until i saw your post and then i had to give it one more go. Thanks a lot. – Muhammad Umer Jul 24 '14 at 21:35
  • also gmail has easier way of doing it which is just emailing then configuring smtp. – Muhammad Umer Jul 24 '14 at 21:36
1

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.

Thorbjørn Ravn Andersen
  • 73,784
  • 33
  • 194
  • 347