I already installed Postfix and it’s working sending from terminal. But Send mail via PHP is not coz I do know what setting or how to create or get the usersname / password and other details needed
//EMAIL SENDING CONFIGURATION
define(‘MAILER’, “smtp”);
define(‘SMTP_HOST’, “”);
define(‘SMTP_PORT’, 587);
define(‘SMTP_USERNAME’, “”);
define(‘SMTP_PASSWORD’, “”);
define(‘SMTP_ENCRYPTION’, “”);
This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
Wordpress uses PHP mail() by default. If you disable/uninstall any extensions that try to manage email sending and delete the configuration lines above from wp-config.php, it should work fine.
You can check if PHP’s mail() function is working properly by creating a file with the following content:
<?php
ini_set('display_errors', 1);
error_reporting(-1);
mail ('you@example.com', 'Postfix Test', 'A test email') || print_r(error_get_last());
?>
Place it in your document root (e.g. /var/www/html) and browse to it. If it’s blank, everything went well and you should receive an email shortly.
PHP uses an MTA to send it’s mails trough mail(),
if you want to override it on system level you could edit /etc/postfix/main.cf and add
relayhost = [smtp.domain.tld]:587
if you are on an older system, you might need to configure sendmail instead
Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.
Full documentation for every DigitalOcean product.
The Wave has everything you need to know about building a business, from raising funding to marketing your product.
Stay up to date by signing up for DigitalOcean’s Infrastructure as a Newsletter.
New accounts only. By submitting your email you agree to our Privacy Policy
Scale up as you grow — whether you're running one virtual machine or ten thousand.
Sign up and get $200 in credit for your first 60 days with DigitalOcean.*
*This promotional offer applies to new accounts only.