How do I send email using PHP?
Windows Hosting Accounts
HostBreak SMTP servers require SMTP authentication therefore your code should be using SMTP AUTH method for sending emails. Therefore to send emails using PHP, you will be using PHPMailer library.
To send emails using PHP, follow these steps:
1. Create an email account, for example firstname.lastname@example.org where mydomain.com is your domain hosted with us.
2. Modify your PHP script to use PHPMailer class and SMTP authentication. Sample scriipt is provided here.
$mail = new PHPMailer();
$mail->IsSMTP(); // set mailer to use SMTP
$mail->Host = "smtp1.example.com;smtp2.example.com"; // specify main and backup server
$mail->SMTPAuth = true; // turn on SMTP authentication
$mail->Username = "email@example.com"; // SMTP username
$mail->Password = "secret"; // SMTP password
$mail->From = "firstname.lastname@example.org";
$mail->FromName = "Mailer";
$mail->AddAddress("email@example.com", "Josh Adams");
$mail->AddAddress("firstname.lastname@example.org"); // name is optional
$mail->IsHTML(true); // set email format to HTML
$mail->Subject = "Here is the subject";
$mail->Body = "This is the HTML message body <b>in bold!</b>";
$mail->AltBody = "This is the body in plain text for non-HTML mail clients";
echo "Message could not be sent. <p>";
echo "Mailer Error: " . $mail->ErrorInfo;
echo "Message has been sent";
Was this answer helpful?
The Redemption Period is a 30 day, Registry-imposed hold period. Domains reach the REDEMPTION...
Welcome to HostBreak.com! We are glad you joined our happy customers family, thank you.Getting...
AvailableThe first step is to register a domain name. You need to choose a domain name and if...
There are several common reasons for not being able to receive emails through Outlook (or other...
You can use Parallels Plesk Panel to set up POP3 email accounts for your domain. Log in to...
Powered by WHMCompleteSolution