On This Page
In short: like most hosting companies, Fiberserver keeps PHP's mail() function disabled, because it sends mail without any authentication and the messages end up in spam or get the server IP blacklisted. Send mail over authenticated SMTP instead: with the PHPMailer library in your own code, or through the SMTP settings of your application.
Why mail() is disabled
The mail() function hands the message to the local mail system without a username, password or sender check. Receiving servers see a message that nobody has vouched for, mark it as spam, and when a script sends too many of them the server's IP address lands on blacklists that affect every customer on it. Authenticated SMTP sends through a real mailbox on your domain, so SPF and DKIM checks pass and the mail is trusted.
Sending with PHPMailer
Download PHPMailer and include it in your project (with Composer: composer require phpmailer/phpmailer). A minimal sending script looks like this:
<?php
use PHPMailer\PHPMailer\PHPMailer;
require 'vendor/autoload.php';
$mail = new PHPMailer(true);
$mail->isSMTP();
$mail->Host = 'mail.yourdomain.com'; // your mail server
$mail->SMTPAuth = true;
$mail->Username = 'name@yourdomain.com'; // a real mailbox
$mail->Password = 'PASSWORD';
$mail->SMTPSecure = 'ssl'; // 'ssl' for port 465, 'tls' for 587
$mail->Port = 465;
$mail->CharSet = 'utf-8';
$mail->setFrom('name@yourdomain.com', 'Your Name');
$mail->addAddress('recipient@example.com');
$mail->isHTML(true);
$mail->Subject = 'Subject line';
$mail->Body = 'Message body';
if (!$mail->send()) {
echo 'Mailer error: ' . $mail->ErrorInfo;
} else {
echo 'Message sent';
}
Set $mail->SMTPDebug = 2; while testing to see the full conversation with the server. The sender address must be a mailbox that exists on the domain you send from; sending as a Gmail address through your own server will fail SPF.
Gmail and Yandex settings
- Gmail: host
smtp.gmail.com, port 465 with SSL (or 587 with TLS); use an app password, not your account password. - Yandex: host
smtp.yandex.com, port 587 with TLS.
SMTP settings in popular applications
Most applications ship with PHPMailer or a similar library and only need the SMTP details in their admin panel. On a Fiberserver hosting account the host is localhost or mail.yourdomain.com, the port is 465 (SSL) and the login is the mailbox and its password.
- WordPress: install the WP Mail SMTP plugin. Mailer: SMTP, host
localhost, port 465, encryption SSL, authentication on, username and password of the mailbox. - vBulletin: Options → Email Options → "Send emails via SMTP server": server
mail.yourdomain.com, port 465, SSL, mailbox and password. - SMF: Admin → Maintenance → Mail: type SMTP, server
ssl://localhost, port 465, mailbox and password. - OpenCart: System → Settings → Mail: protocol SMTP, host
ssl://localhost, port 465, mailbox and password.
Other applications use the same four values: host, port, mailbox, password.
If mail still goes to spam
Check that your domain has SPF, DKIM and DMARC records; our SPF, DKIM and DMARC guide explains them. For newsletters and bulk sending use a dedicated service such as our SMTP sending plans rather than the hosting mailbox.
Thanks for your feedback!
