9tontruck 0 Newbie Poster

Hi,

I have a domain and DigitalOcean cloud ubuntu server, and I have been using the server as an email forwarding point. SImply, if someone sends an email to info@domain.com, the server forwards to personal@gmail.com. The beauty of this is that I don't need to spend my server space used up for saving email and I can still use gmail UI. Downside is I have to reply using gmail account.

So I wanted to send an email using my domain email from gmail website. Custom domain email hosting in Google and Hotmail is not free so please don't mention it.

So I am looking for a way to smart email piping system and here is what it supposed to do:

customer -> server -> I
customer <- server <- I

**When customer sends an email**
from: customer@hotmail.com
to: info@domain.com


**When server forwards to me**
from: info-customer-hotmail.com@domain.com
to: personal@gmail.com


**when I reply**
from: personal@gmail.com
to: info-customer-hotmail.com@domain.com


**When the server forward to the customer**
from: info@domain.com
to: customer@hotmail.com

Basically it's free custom domain email hosting that allows using Gmail environment.

Is there any library doing this kind of things?

Thanks,

Dani AI

Generated

This is exactly the pattern you described: per-sender (on‑the‑fly) aliases that forward inbound mail to your inbox and route replies back using a unique reply address. Two practical paths:

  • Use an existing open‑source alias/forwarding project (saves a lot of work). Self‑hostable projects that implement per‑sender aliases, reply routing and admin UIs include SimpleLogin, AnonAddy and ForwardEmail — each can be run on a VPS and do the heavy lifting for you. (github.com)

  • DIY with Postfix + a tiny app: accept mail for info@yourdomain and use Postfix’s pipe/transport to hand each incoming message to a small script. The script:

    1. creates a stable token for the original sender (store mapping token -> sender in a DB),
    2. rewrites the forwarded message’s recipient/from to an alias derived from that token so replies come back to your script, and
    3. forwards the modified message to your Gmail. Postfix supports piping deliveries to a program for exactly this use. (postfix.org)

Example workflow (pseudocode):

on_receive(mail):
  token = HMAC(sender + now)[:12]
  store(token -> sender)
  alias = "info+" + token + "@domain.tld"
  rewrite_recipient_and_from(mail, to=your@gmail, from=alias)
  send(mail)
on_reply(mail_to_alias):
  token = extract_token(mail_to_alias)
  dest = lookup(token)
  forward_as_domain_from(mail, to=dest)   # send via your server SMTP

If you only need to send as info@domain.com (not per-sender aliasing), the simplest route is Gmail’s “Send mail as” using your domain SMTP — you can reply from Gmail but have outbound mail go through your server so SPF/DKIM align. ()

Cautions: handle SPF/DKIM/DMARC (sign outgoing mail and include your server in SPF), think about attachments, threading headers, bounce handling and rate limits, and protect the token->recipient store. For most people starting with SimpleLogin/AnonAddy/ForwardEmail is far faster than building everything yourself.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.