Hello to all,
… I have configured two virtual servers on virtualmin that work well but I would like to use mail from an external hosting to send emails from the forms of the two sites.
I activated the user “firstname.lastname@example.org” on email hosting and point external dns to it and works perfectly, but the emails sent by the forms of the two sites in virtualmin stay in home of the two default users.
I also tried to disable the mail services for the two virtual servers (Virtualmin - Edit Virtual Server - Enabled features: unchecked “Mail for domain enabled?” And also antivirus and antispam) but nothing.
Is there a tutorial or guide I can follow for this specific problem ?
I really have been looking for a solution to my problem for a very long time… : ((
Thanks to anyone who can help me …
I think you need to get the PHP (perhaps) forms to use SMTP auth (or similar) to login to the external mail hosting to send the emails. https://help.dreamhost.com/hc/en-us/articles/216140597-How-do-I-send-PHP-mail-via-SMTP- might get you where you need to be.
… my sites are on wordpress, so I could use a plugin to send, but I think there is an alternative solution configuring only Webmin / virtualmin.
I have seen that webmin uses Postfix and Dovecot to create its own email server, but possibly I would like to disable them because my vps only has 1Gb ram.
I read that by deactivating the mail server for a domain, emails are sent to the correct address by default, instead of putting them in the user’s home, but unfortunately this does not happen.
Thanks for your help Dibs, I really appreciate it …
Hi Gianni, If you disable Postfix\Dovecot at the VPS level, then I wouldn’t think your VPS would respond to any traffic on Port 25. But if you have other domains (& Virtual Servers) on the VPS - then that might not be doable. So you would want it to receive mail for other domains but not those 2 (and also not send for those 2). Does the following help you at all?
IF switching of email only for domain / that virtualservers, and postfix still running on the hostname / server, then most mailforms use that host/username mail in virtualmin server mailfunctions / postfix if so.
ONLY PHP SMTP mailforms , or maybe more special own postfix config ( mappings and so i believe) but then still running and using resources from your server by postfix.
NOT RUNNING POSTFIX or other mailsystem on that box then you have to config everything for external MAIL systems to still get warning / errrors and all the virtualmin / webmin / firewall notifications and so on.
IF USING FORWARDS for example then with aliases hmm then also dkim/dmarc/spf would become problem with bounces a guess.
AND YOU SERVER IP goes here in short time
OYEA Wordpress and more sites 1GB is way to low.
… make it clearer:
- I created my vps (1Gb ram) with webmin and 3 simple virtual sites in Wordpress, each with a contact form.
- all e-mails of the 3 domains, incoming and outgoing, reside on an external hosting.
Is possible to configure webmin to send contact forms without creating your own mail server (and without WP plugin)?
thank you very much also for the link, it does not suit my needs but it is still very interesting. : )
With no mail server - meaning no forwarding or relaying, I don’t see how PHP could send the mail. You would need PHP, either coded yourself or a WP plugin to login to your external mailserver and send the emails from the form. Webmin & Usermin to my understanding (could be wrong) are just GUI’s to not have to alter the various config files manually.
Hi Jfro, thanks for your contribution …
So if I understand correctly, there are three solutions:
- use WP plugin (php smtp server) and disable postfix and Dovecot
- use postfix as SMTP to send forms and disable Dovecot
- use postfix configured to send with external SMTP
While the first two solutions use many resources to send through my VPS, the third solution connects external hosting to send, I think using fewer resources … and also should not be problems for DKIM and DMark. Correct?
Tonight I was able to configure Virtualmin for solution 3, but it seems impossible to use a different email hosting for each domain.
I have in fact configured Postfix from Webmin - Server - Postfix: “Send outgoing mail via host” but ALL domains use this SMTP, while it is important that each domain uses a different SMTP …
What do you think about it?
When you do it it Webmin - I think that’s doing it at the global level. Used for those kinds of situations where the ISP blocks port 25 and requires you to relay all mail thru their mailservers. Less applicable to a VPS & Data centre environment but an applicable case.
You want to do it on a per domain basis - if I understand you correctly. That’s going to require altering Postfix files manually (I think). The following link should hopefully help - https://serverfault.com/questions/565573/postfix-smtp-authentication-per-domain
Yes you are right. But on the VPS there are only three very small WP sites and I have a really small budget.
I have also disabled statistics, antivirus and antispam and I also hope Dovecot.
On WP I’ve activate the cache and use Cloudflare, it doesn’t go so bad … : ))
This link https://forums.zimbra.org/viewtopic.php?t=3859 has probably better details\instructions. You just need to “adjust” file locations to ignore the zimbra locations and use the ones relevant to your OS.
Budget - manually adjusting the files should not cost you anything.
On my VPS which also has 1GB, I have disabled AV, but it runs everything else and has 2 static WP sites and 1 static HTML\PHP site and since I spent some more time on it - it runs very well. Just required some reading, learning and altering config files. Admittedly, I’m not new to Linux (far from an expert).
Yes, you’re right, but I don’t think that Webmin is just a ui, it has a “api” and several basic modules written in perl. It could easily use the Email :: Send function in one of its basic modules or one of the other 936 ways to send an email in Perl.
But after so much reading, I also believe that it is necessary to keep at least Postfix to be able to connect to the external SMTP server.
And now the question becomes: how to set Postfix to use a different SMTP for each virtual domain?
Thanks Dibs, for clarifying my ideas … : )
You may well be right - Webmin may have an API, I haven’t delved into it in that level of detail. For me it’s like Virtualmin - an administrative tool (UI was probably not the best\correct description). To my mind, they only go so far - for more advanced\serious stuff, I’ve ended up manually altering the relevant config files to get what I want.
Take a post - which I think is virtually identical to yours - If you look at the following post https://www.virtualmin.com/node/67429 - the poster is referred to changing the config under the “hood”. Or that’s my take on it.
If Postfix is the MTA, that will need the configuration. You could use a lightweight equivalent that isn’t a full blown MTA. I think there are some about. Or as you pointed out, Email::Sender the successor to Email::Send but you’d have to alter the code in the forms to do that. Or maybe write a module\function that did it and the WP forms\sites didn’t realise there wasn’t a full blown MTA underneath (might have cons as well as pros).
: ) useful link !!!
… But I would first try to look if I can configure webmin in “per domain” mode (because I would not have to manually reconfigure it when upgrading).
If I can’t find anything I try the manual configuration you suggested …
Thanks for the very interesting discussion Dibs. : )
Can’t help sorry.
Am no programmer and not using WP
Also using mself only Postfix with virtualmin then the mailserver host is also default for everydomain on our box , so mx points to mail.hostname.
Using EXIM on other systems but in the same way.
Simple because less problems in such configs, easier to take care of, (If custommer domains with real own IP’s then maybe) SNI POSTFIX hmm , it wasn’t made for.
Gianni - let us know how you get on? The final solution (workable) might be of interest to others at some point.
Unfortunately my life is a bit complicated and sometimes I have to turn off my PC.,
As soon as I have time I’ll try the configuration suggested, if it works I definitely post it here… : )
You might be able to do this by removing postfix and installing a minimal SMTP sender like nullmailer or dma that doesn’t need much memory. Configure that to send via authenticated SMTP to the other server that can relay mail for the domains. Those programs emulate sendmail, and PHP’s mail() function should be able to connect to them via a local socket or localhost.
Anahata - Wow - what are the chances of randomly “bumping” into someone on the internet that lives 10 miles down the road. LOL