Using mailserver (as smtp) for other servers as well

Hello,

im currently a bit confused. Maybe someone of you guys can help me out here. So basically i setup 1 seperat vm with its own IP for the mailinabox mail server. But i would like to use the mail server for another server as well. So for example

Domain:
example.com

server 1:
IP: 111.111.111.111
(Mailinabox server)

server 2:
IP: 222.222.222.222
Apache installed / here is my website running.

I would like to send mails on “Server 2” e.g server2@example.com but i want to use the mail server from server1 since otherwise if i use sendmail on server2 they always get in my spam folder.

Can i whitelist my server2 in mailinabox or something like that? I hope i explained it enough :smiley:

Thanks for your help!!

Kind regards

PHP has configuration options to change the SMTP server for sendmail, otherwise wordpress (and other CMS/Blogging/PHP frameworks) include a plugin and/or configuration option to set an SMTP server.

Hi,

thanks for your answer. So basically im using a selfcoded webinterface for my customers. But im just wondering if i need to whitelist my server first on the mailinabox server? Because i really dont hope its open for all incomming connections to use it as a smtp server… :confused:

Thanks

It’s not open to anyone, but server2 will not use server1 as SMTP unless configured to do so.

server2 will use its own built in SMTP server (Installed with PHP most likely) but PHP can be configured to use server1 instead. Or for a simpler solution:
https://github.com/PHPMailer/PHPMailer

Try that it will need to be integrated into your web interface, but does what you need it to do.

Hi,

thanks for the tips with the PHPMailer. Ill try that. Do i need to whitelist server2 in any way to use the mailserver on server 1?

No, just need a username and password.

Thanks alot! It worked now :slight_smile: