sending and receiving emails with GCP - email

I'm switching from a shared hosting provider to GCP. I have a domain name (domain.com), and on the shared hosting I just had to create a new email address in the directadmin panel, and use squirrelmail to send/receive emails.
The problem is: I don't know how to achieve this on GCP.
I have added a new zone in cloud DNS for the domain name, and I have changed the nameservers of the domain name at my hosting provider (where the domain name is parked).
Now I'm looking for a solution so I can use the domain name (coupled to a VM) but also send/receive emails in an easy way.
Is there a (paid/free) solution I can use which isn't very difficult to install/maintain? I was thinking of creating a mailserver with postfix/postfixadmin, but GCP blocks outgoing mail so I have to use a service like sendgrid or mailgun to send email + I still need to install postfix for receiving email. But to be honest: I've never done this before and I don't find any good tutorials about this.
I have a mailgun account and I tried following this (https://cloud.google.com/compute/docs/tutorials/sending-mail/using-mailgun) tutorial, but the emails I'm sending are not delivered.
Is there an online service or something like that where I can couple my domain name to, to send and receive emails? I tried to google it, I googled on "external mail server" and "free mail server" but I didn't find any (good) results.
Thanks in advance!

Mailgun sounds like a good option to use, if you're still planning to use it on GCP, check that you've created a firewall rule to allow outbound traffic [1]. This step might be the reason why you're not receiving the emails.
If you need a good guide to set up a Postfix server, you might find this guide useful [2].
I've read that you're already using G Suite [3], this option is great and will ease the process a lot.

Related

Configure IMAP/SMTP on existing Server for existing Domain (Ubuntu 20.04)

I have a Server (DigitalOcean Droplet) with a domain/website hosted on it using LAMP. I want to add a webmail server, to be able to send e-mails through SMTP and receive e-mails to forward them to external IMAP clients.
I need to send e-mails for app/site notifications, I send e-mails through simple SMTP scripts. And I need to receive e-mails being sent to my email#domain.com to then forward them to external IMAP clients.
I want to configure it with the minimum requirements, cause I want to have it in the same server where I host my site and I don’t want it to consume too much memory/cpu.
Any recommendations?
I’ve seen this Postfix steps (https://www.digitalocean.com/community/tutorials/how-to-install-and-configure-postfix-on-ubuntu-20-04) but I don’t know if it’s what I need.
I also believe that I need to configure some DNS records, such as MX, SPF, DMARC and DKIM. But these are not mentioned on above link.
Notes:
I do not own any e-mail hosting server, my intention is to create one with this. Is Postfix what I need?
I want to create e-mail accounts such as: noreply#domain.com, help#domain.com, sales#domain.com
I don’t want to control an external e-mail account, I want to host it here in this server.
Thanks in advance.

Sending mail using GCP on private network

More than a simple question-answer, this is more of a recommendation post. Want to see what ideas I have to work with. I am working on porting my company's work to the cloud (GCP) Most of this work is in the form of a pipeline. I'd like to notify completion via email.
The company I work for has a private network. And so the only way to use their mail config is to send it through their internet, and so, cannot use their SMTP-config from GCP.
What's the best way around this?
I'm looking into creating a VPN between GCP and our local network, however, that may not be possible (IT restrictions)
Do I have any other options?
EDIT
What an SMTP Relay work? This guy.
By default, Compute Engine allows outbound connections on all ports but port 25,so if you need to send an email from the instance you have to use port 465 or 587.
GCP explecitely recomends using other third-party tools such as SendGrid, Mailgun, and Mailjet because they offer a free tier package, you can skip all that and connect your instance to Gmail SMTP Relay Service. You will need a Google Account to connect (gmail or Gsuite).
Instructions to configure the Google Account are HERE , I tested sending emails from my MySQL server and Debian 9

How to install mail server on vps (digitalocean)

I need send and receive e-mails. I need configure on Digital Ocean Vps a Mail server.
I need a how to or any recommendation about it. I think I will have to create a database to store messages.
I have seen:
Mailgun: I have created an account and created dns records Mx and Txt but Its not verified yet. So I can't receive email.
SendMail: I think it's I have already installed but I don't know how to send and receive email from hello#domain.com
Postfix: I've tried to install didn't work it
Thanks.
Mailservers are complex beasts of software. Installing your own might be a bad idea, unless you're willing to invest time to
make it secure
protect it against spam and viruses
back up your emails
understand topics such as DMARC and TLS and greylisting
...
See why you may not want to run your own mail server for more information.
Maybe you could use an email provider instead? Google Suite is a great choice :)
There's an open-source solution
Mail-in-a-Box lets you become your own mail service provider in a few easy steps. It’s sort of like making your own gmail, but one you control from top to bottom.
Technically, Mail-in-a-Box turns a fresh cloud computer into a working mail server.

cPanel 'No such user here'. Local account issue?

I have a website hosted outside the organization. The mail server to recieve the message is inside the organization. The website submits a simple form to email using PHP mail function. Works on every domain tested for the recipient except for ones internal to the domain.
So website is www.domain.com. Mail server is mail.domain.com. Hosted at separate sites. When www.domain.com wants to send a message to user#domain.com it should lookup the mx record and notice that mail.domain.com is at another location and forward the message.
If I configure it to send to user#otherdomain.com, the message is successfully sent and received. But sending to the same domain responds with 550 error 'No such user here'. So I'm wondering if the webserver thinks it is supposed to be the recipient of the mail, and thus responds with 'No user here' because, frankly there is no user configured there.
So does anyone know what cpanel/whm settings need to be added/adjusted to allow this server to know that it is not responsible for mail exchanging for this domain. I do have the mx record setup properly, but don't know if it also requires an A record for the address. Any help much appreciated.
I did notice others having the same issues, but no solutions were actually proposed, so I figured I would make my own question, and see if it get's a good answer for others too that may experience the same issue.
It looks like your routing settings are incorrect. Navigate to cPanel >> MX Entry and verify that the routing setting is Remote Mail Exchanger
As the mails are to be delivered externally, setting this as Local Mail Exchanger will make cPanel think the mails are setup locally and cPanel will try to deliver mails locally. As there are no local mail accounts configured with that name, it bounces with the mentioned error.
I would suggest avoiding sending directly to the MX. Submit your message to a local mail server and let it relay to the MX for you. If you send using PHPMailer with SMTP you will get much better feedback on deliveries. As for what cPanel is doing, check the local mail server log, usually in /var/log/mail.log.
You have to change the setting from local to "Remote Mail Exchanger" in dns zone file. and also create mail account at remote location site.

AWS SES + TLS: custom domain for mail servers

When messing around with different mail hosting options I noticed a very aggravating pattern with my Android phone. Neither the built-in mail app nor the gmail app supported email auto-configuration.
When using most mail services such as Namecheap, Zoho, Rackspace, etc. this became a real issue. I would enter my email address and password then instead of it just working like magic, it would invariably fail as it attempted to set the mail server to mail.example.com instead of mail.privateemail.com or smtp.zoho.com
I can configure a CNAME entry for my domain to redirect to these servers and successfully connect to mail.example.com.... up until I try to enable secure e-mail (STARTTLS or TLS wrapper). When I do this the domain name on the certificate does not match up to the domain name I am using to access and the whole thing fails.
Of course setting up my own mail server could be an option, but it could take months or years for my IP address to build up enough reputation to not get auto-blocked by major providers like Gmail or Yahoo. This whole past month DreamHost has been unable to send emails to any address owned by AT&T, which has been nightmarish to get resolved. Not wanting an issue like that, I would like to go with a big name for e-mail hosting.
While looking into Amazon SES to see if it would be easy to set up, I noticed this page on secure tunnels to AWS SES
I'm not super familiar with mail servers and I honestly have no idea what I'm reading on this page. Like I can follow the steps to install and configure this program and run it, but it doesn't accurately say what the purpose is of doing this. Am I right in believing that this might solve my SSL issue and allow me to send mail to mail.example.com without any issues? If so, is there any additional setup that I will require which is not adequately explained by this article?