{"id":685,"date":"2023-05-15T06:12:00","date_gmt":"2023-05-15T06:12:00","guid":{"rendered":"http:\/\/blog.hostinger.io\/hostinger-tutorials\/uncategorized\/websitehow-to-send-emails-using-php\/"},"modified":"2025-02-12T03:20:07","modified_gmt":"2025-02-12T03:20:07","slug":"send-emails-using-php-mail","status":"publish","type":"post","link":"\/ph\/tutorials\/send-emails-using-php-mail","title":{"rendered":"How to send emails from your web server with the PHP mail() function and PHPMailer"},"content":{"rendered":"<p>Most businesses choose to create a professional email account to boost their credibility and build customer trust. To accomplish this, you just need to buy a domain and set up your business email on an email client or a server.<\/p><p>If you build your website or web application with the PHP programming language, you can send emails directly from your web server. The PHP mail functionality enables you to create custom mail forms and send basic text-based emails to multiple recipients.<\/p><p>There are two ways to send emails in PHP &#8210; using the built-in PHP <strong>mail()<\/strong> function or a mail-sending library such as PHPMailer.<\/p><p>In this article, we&rsquo;ll cover the differences between PHPMailer and the <strong>mail()<\/strong> function, showing you how to send emails with both.<\/p><p class=\"has-text-align-center\"><a href=\"https:\/\/assets.hostinger.com\/content\/Web-Development-Glossary-for-Beginners.pdf\" target=\"_blank\" rel=\"noopener\">Download glossary for web beginners<\/a><\/p><p>\n\n\n\n\n\n<div class=\"protip\">\n                    <h2 class=\"featured-snippet title\">What is PHP Mail?<\/h2>\n                    <p>PHP mail is a function for sending emails with PHP scripts. The built-in PHP function can target multiple recipients per email sending. However, it isn&rsquo;t suitable for bulk emailing without using an external PHP mailing package like PHPMailer.<br>\n<\/p>\n                <\/div>\n\n\n\n<\/p><h2 class=\"wp-block-heading\" id=\"h-phpmailer-vs-mail-function-pros-and-cons\"><strong>PHPMailer vs mail() function: pros and cons<\/strong><\/h2><p>PHP mail allows PHP-based website administrators to send mail from their web server using PHP scripts. It&rsquo;s a popular alternative to getting a third-party email hosting service, as the PHP function is integrated with the web server.<\/p><p>Sending emails in <a href=\"\/ph\/tutorials\/what-is-php\/\">PHP<\/a> is possible via the native PHP <strong>mail()<\/strong> function or an external PHP mailing package like PHPMailer. Here&rsquo;s a brief coverage of each method, including their advantages and disadvantages:<\/p><p><strong>PHP mail() function<\/strong><\/p><p><strong>Mail()<\/strong> is a PHP function that uses PHP scripts to send simple emails. The mail function includes three mandatory parameters &#8210; <strong>$to<\/strong>, <strong>$subject<\/strong>, and<strong> $message<\/strong>. Optional parameters to utilize include <strong>$headers<\/strong> and <strong>$parameters<\/strong>. We&rsquo;ll cover them in more detail later.<\/p><p>This built-in PHP function returns a boolean value upon execution &#8210; <strong>TRUE<\/strong> if the server successfully receives the email for sending or <strong>FALSE <\/strong>on failure.<\/p><p><strong>Advantages:<\/strong><\/p><ul class=\"wp-block-list\">\n<li>Pre-installed and ready to use, all you need is to have PHP.<\/li>\n\n\n\n<li>Backward-compatible, a <a href=\"\/ph\/tutorials\/how-to-change-your-php-version\">PHP version change<\/a> won&rsquo;t break the script.<\/li>\n\n\n\n<li>Easy to learn.<\/li>\n<\/ul><p><strong>Disadvantages:<\/strong><\/p><ul class=\"wp-block-list\">\n<li>Sends emails using an outdated method without built-in support for modern authentication like SPF and DKIM.<\/li>\n\n\n\n<li>Often lands in spam or junk folders due to missing authentication and improper configuration.<\/li>\n\n\n\n<li>Requires complex setup for SMTP, increasing the chance of triggering spam filters.<\/li>\n\n\n\n<li>Cannot handle large volumes of emails effectively.<\/li>\n\n\n\n<li>Offers lower sending limits and less reliability compared to PHPMailer.<\/li>\n\n\n\n<li>Returns <strong>TRUE<\/strong> even if the email fails to reach the recipient.<\/li>\n<\/ul><p>\n\n\n<div><p class=\"important\"><strong>Important!<\/strong> For Hostinger users, keep in mind that the current limits for emails sent via PHP mail() are <strong>100\/day<\/strong> and <strong>10\/minute<\/strong>. These limits will reset every 24 hours and they will be consumed immediately if there are queued emails.<\/p><\/div>\n\n\n\n<\/p><p><strong>PHPMailer<\/strong><\/p><p>PHPMailer is a popular mail-sending library that supports the process via the <strong>mail()<\/strong> function or through a <a href=\"\/ph\/tutorials\/smtp-port\">Simple Mail Transfer Protocol (SMTP)<\/a> server. It gives access to a set of functions for sending mail, simplifying the manual PHP mail configuration process.<\/p><p><strong>Advantages<\/strong>:<\/p><ul class=\"wp-block-list\">\n<li>Sends emails over a secure connection with SPF and DKIM authentication, improving inbox delivery.<\/li>\n\n\n\n<li>Simplifies email configuration and supports advanced features like HTML bodies and attachments.<\/li>\n\n\n\n<li>Supports SMTP with integrated <a href=\"\/ph\/tutorials\/what-is-ssl\">SSL<\/a> and <a href=\"\/ph\/tutorials\/what-is-tls\">TLS<\/a> encryption.<\/li>\n\n\n\n<li>Handles large volumes of email efficiently in a short period.<\/li>\n<\/ul><p><strong>Disadvantages<\/strong>:<\/p><ul class=\"wp-block-list\">\n<li>Requires manual installation through SSH.<\/li>\n\n\n\n<li>Incurs additional costs on Hostinger&rsquo;s <strong>Single<\/strong> web hosting plan due to the lack of SSH access.<\/li>\n\n\n\n<li>Has a steeper learning curve compared to the built-in <strong>mail()<\/strong> function.<\/li>\n<\/ul><p>\n\n\n<div><p class=\"important\"><strong>Important!<\/strong> If you use PHPMailer with <a href=\"https:\/\/support.hostinger.com\/en\/articles\/5326155-parameters-and-limits-of-titan-email\" target=\"_blank\" rel=\"noopener\">Titan Mail on Hostinger, the sending limit is<\/a> <strong>1000 emails\/day<\/strong> and <strong>300 emails\/hour<\/strong>. For <a href=\"https:\/\/support.hostinger.com\/en\/articles\/4625828-parameters-and-limits-of-hostinger-email\" target=\"_blank\" rel=\"noopener\"> Hostinger&rsquo;s email service, the limit is higher<\/a> &ndash; up to <strong>3000 emails\/day<\/strong> with no hourly limit. Check the parameters and limits for each service, as they vary depending on your hosting plan.<\/p><\/div>\n\n\n\n<\/p><h2 class=\"wp-block-heading\" id=\"h-how-to-use-phpmailer-to-send-emails\"><strong>How to use PHPMailer to send emails<\/strong><\/h2><p>In this section, we&rsquo;ll cover the steps of using PHPMailer to send mail. We recommend using an authenticated SMTP connection with PHPMailer to increase the deliverability of your emails against spam filters.<\/p><h3 class=\"wp-block-heading\" id=\"h-installing-phpmailer\">Installing PHPMailer<\/h3><p>Installing PHPMailer is quite simple, especially when using <a href=\"\/ph\/tutorials\/how-to-install-composer\">Composer<\/a>.<\/p><p>Note that Hostinger&rsquo;s <a href=\"\/ph\/web-hosting\">Premium and Business<strong> <\/strong>web hosting plans<\/a>, as well as <a href=\"\/ph\/cloud-hosting\">cloud hosting options<\/a>, come pre-installed with two versions of this software.<\/p><?xml encoding=\"utf-8\" ?><figure class=\"wp-block-image size-full\"><a href=\"\/ph\/web-hosting\"><img decoding=\"async\" width=\"1024\" height=\"300\" src=\"https:\/\/www.hostinger.com\/tutorials\/wp-content\/uploads\/sites\/2\/2023\/11\/Web-hosting_in-text-banner.png\" alt=\"Hostinger web hosting banner\" class=\"wp-image-98604\" srcset=\"https:\/\/www.hostinger.com\/ph\/tutorials\/wp-content\/uploads\/sites\/44\/2023\/11\/Web-hosting_in-text-banner.png 1024w, https:\/\/www.hostinger.com\/ph\/tutorials\/wp-content\/uploads\/sites\/44\/2023\/11\/Web-hosting_in-text-banner-300x88.png 300w, https:\/\/www.hostinger.com\/ph\/tutorials\/wp-content\/uploads\/sites\/44\/2023\/11\/Web-hosting_in-text-banner-150x44.png 150w, https:\/\/www.hostinger.com\/ph\/tutorials\/wp-content\/uploads\/sites\/44\/2023\/11\/Web-hosting_in-text-banner-768x225.png 768w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/a><\/figure><p>Use the <strong>composer<\/strong> command to activate Composer version 1.10. If you need the new 2.0 version or you&rsquo;re using PHP version 8.0 or later, execute the <strong>composer2<\/strong> command.<\/p><p>\n\n\n<div><p class=\"important\"><strong>Important!<\/strong> You must install PHPMailer using Composer through SSH for it to work correctly. Adding a <strong>phpmailer.php<\/strong> file with SMTP code, as we&rsquo;ll cover later in this guide, won&rsquo;t work without proper installation.<\/p><\/div>\n\n\n\n<\/p><p>Follow these steps to install PHPMailer manually:<\/p><ol class=\"wp-block-list\">\n<li>Connect to your account via an SSH client.<\/li>\n\n\n\n<li>From your <a href=\"\/ph\/tutorials\/hpanel-tutorial\">hPanel dashboard<\/a>, go to <strong>Advanced<\/strong> &rarr; <strong>SSH Access<\/strong> and take note of the <strong>SSH IP<\/strong>, <strong>port<\/strong>,<strong> username<\/strong>, and <strong>password <\/strong>under the <strong>SSH details<\/strong>.<\/li>\n\n\n\n<li>Open PuTTY and enter your SSH information in the <strong>Host Name (or IP address)<\/strong> and <strong>Port <\/strong>fields. Then, click <strong>Open<\/strong>.<\/li>\n<\/ol><ol start=\"4\" class=\"wp-block-list\">\n<li>Once a command window appears, type in your SSH username and password and hit <strong>Enter<\/strong>. Remember that PuTTY will not display the password, so don&rsquo;t be surprised if it doesn&rsquo;t appear on the screen.<\/li>\n\n\n\n<li>Execute the following command to navigate to the <strong>public_html<\/strong> directory:<\/li>\n<\/ol><pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">cd public_html<\/pre><ol start=\"6\" class=\"wp-block-list\">\n<li>Run the following command to install Composer:<\/li>\n<\/ol><pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">composer2 require phpmailer\/phpmailer<\/pre><ol start=\"7\" class=\"wp-block-list\">\n<li>Wait a moment until the installation process is finished. Here&rsquo;s what it should look like:<\/li>\n<\/ol><div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><a href=\"\/ph\/tutorials\/wp-content\/uploads\/sites\/2\/2023\/05\/Finished-Composer-installation-process.png\"><img decoding=\"async\" width=\"733\" height=\"335\" src=\"\/tutorials\/wp-content\/uploads\/sites\/2\/2023\/05\/Finished-Composer-installation-process.png\" alt=\"Finished Composer installation process\" class=\"wp-image-85515\" srcset=\"https:\/\/www.hostinger.com\/ph\/tutorials\/wp-content\/uploads\/sites\/44\/2023\/05\/Finished-Composer-installation-process.png 733w, https:\/\/www.hostinger.com\/ph\/tutorials\/wp-content\/uploads\/sites\/44\/2023\/05\/Finished-Composer-installation-process-300x137.png 300w, https:\/\/www.hostinger.com\/ph\/tutorials\/wp-content\/uploads\/sites\/44\/2023\/05\/Finished-Composer-installation-process-150x69.png 150w\" sizes=\"(max-width: 733px) 100vw, 733px\" \/><\/a><\/figure><\/div><p>\n\n<div class=\"protip\">\n                    <h4 class=\"title\">Suggested reading<\/h4>\n                    <p>Learn more <a href=\"\/ph\/tutorials\/ssh\/basic-ssh-commands\">SSH commands<\/a> to help manage your server.<\/p>\n                <\/div>\n\n\n\n<\/p><h3 class=\"wp-block-heading\" id=\"h-understanding-phpmailer-components\">Understanding PHPMailer components<\/h3><p>To understand how PHPMailer works, let&rsquo;s review each script component above.<\/p><ul class=\"wp-block-list\">\n<li><code>use PHPMailer\\PHPMailer\\PHPMailer;<\/code> &ndash; imports the PHPMailer class to the <a href=\"https:\/\/www.php.net\/manual\/en\/language.namespaces.php\" target=\"_blank\" rel=\"noopener\">global namespace<\/a>.<\/li>\n\n\n\n<li><code>require '..\/vendor\/autoload.php';<\/code> &ndash; includes various libraries that PHPMailer needs.<\/li>\n\n\n\n<li><code>$mail = new PHPMailer;<\/code> &ndash; creates a new PHPMailer object.<\/li>\n\n\n\n<li><code>$mail-&gt;isSMTP();<\/code> &ndash; tells PHPMailer class to use the custom SMTP configuration defined in the script instead of the local mail server.<\/li>\n\n\n\n<li><code>$mail-&gt;SMTPDebug = 2;<\/code> &ndash; detects if something goes wrong with the SMTP connection.<\/li>\n\n\n\n<li><code>$mail-&gt;Host = 'smtp.hostinger.com';<\/code> &ndash; this is where the SMTP server address should be specified.<\/li>\n\n\n\n<li><code>$mail-&gt;Port = 587;<\/code> &ndash; set the SMTP port here. We&rsquo;ll pick <a href=\"\/ph\/tutorials\/smtp-port-587\">SMTP port 587<\/a> as the default mail submission port for all types of SMTP data transmission.<\/li>\n\n\n\n<li><code>$mail-&gt;SMTPAuth = true;<\/code> &ndash; activates SMTP authentication.<\/li>\n\n\n\n<li><code>$mail-&gt;Username = 'mymail@myawesomedomain.tld';<\/code> &ndash; specify your email address here.<\/li>\n\n\n\n<li><code>$mail-&gt;Password = 'My$tr0ngPa55w0rd!;<\/code> &ndash; enter your email password here.<\/li>\n\n\n\n<li><code>$mail-&gt;setFrom('mymail@myawesomedomain.tld', 'Your Name');<\/code> &ndash; this is where you insert the sender&rsquo;s email address.<\/li>\n\n\n\n<li><code>$mail-&gt;addReplyTo('mymail@myawesomedomain.tld', 'Your Name');<\/code> &ndash; informs the recipient which address they should reply to.<\/li>\n\n\n\n<li><code>$mail-&gt;addAddress('recipient@domain.tld', 'Receiver Name');<\/code> &ndash; insert the recipient&rsquo;s address here.<\/li>\n\n\n\n<li><code>$mail-&gt;Subject = 'Checking if PHPMailer works';<\/code> &ndash; add the email subject here.<\/li>\n\n\n\n<li><code>$mail-&gt;msgHTML(file_get_contents('message.html'), __DIR__);<\/code> &ndash; reads an HTML message body from an external file. The <strong>file_get_contents()<\/strong> function will load the content from <strong>message.html<\/strong>, a local file located in the <strong>public_html <\/strong>directory, and include it in the message.<\/li>\n\n\n\n<li><code>$mail-&gt;Body = 'This is just a plain text message body';<\/code> &ndash; contains the mail message body.<\/li>\n\n\n\n<li><code>\/\/$mail-&gt;addAttachment('attachment.txt');<\/code> &ndash; if you want to include attachments, add the file names and remove the double slash from this statement.<\/li>\n\n\n\n<li><code>if (!$mail-&gt;send()) {<\/code> &ndash; defines what happens when the script is executed.<\/li>\n\n\n\n<li><code>echo 'Mailer Error: ' . $mail-&gt;ErrorInfo;<\/code> &ndash; you will see an error message and details of the error if the script fails to send.<\/li>\n\n\n\n<li><code>} else {<\/code><strong> <\/strong>&ndash;<strong> <\/strong>extends the <strong>if<\/strong> statement and describes what happens if the previous condition is not met.<\/li>\n\n\n\n<li><code>echo 'The email message was sent!';<\/code> &ndash; means the email sending process is successful.<\/li>\n<\/ul><p>\n\n\n<div class=\"protip\">\n                    <h4 class=\"title\">Pro tip<\/h4>\n                    <p>The <strong>SMTPDebug = 2;<\/strong> line is only applicable when you test a script and want to see how it operates. Remember to change it to <strong>SMTPDebug = 0;<\/strong> when you are done with the test to prevent receivers from catching the SMTP protocol delivery report.<\/p>\n                <\/div>\n\n\n\n<\/p><h3 class=\"wp-block-heading\" id=\"h-using-phpmailer-with-hostinger-smtp\">Using PHPMailer with Hostinger SMTP<\/h3><p>After installing PHPMailer, you can start sending emails in PHP. In this section, we&rsquo;ll show you how to send email through the Hostinger SMTP server using PHPMailer.<\/p><p>To do so, follow the steps below:<\/p><ol class=\"wp-block-list\">\n<li>Create an email account by accessing <strong>hPanel<\/strong>, then go to <strong>Emails <\/strong>&rarr; <strong>Email Accounts<\/strong> &rarr; <strong>Create email account<\/strong>.<\/li>\n\n\n\n<li>Fill in the new email address and set a password. Then, click <strong>Create<\/strong>. Remember this information as you will use it to send mail via PHPMailer.<\/li>\n\n\n\n<li>From the same page, go to <strong>Configuration Settings<\/strong> &rarr; <strong>Manual Configuration<\/strong> and take note of the <strong>SMTP Port <\/strong>and <strong>Hostname<\/strong>.<\/li>\n<\/ol><ol start=\"4\" class=\"wp-block-list\">\n<li>Access the <strong>hPanel<\/strong> dashboard and navigate to <strong>Files <\/strong>&rarr; <strong>File Manager<\/strong>. Click on the <strong>public_html<\/strong> folder and select <strong>Add New <\/strong>to create a new file. Name the file <strong>phpmailer.php<\/strong> and click <strong>Create<\/strong>.<\/li>\n\n\n\n<li>Double-click on the <strong>phpmailer.php<\/strong> file, and copy and paste the code below after making all the necessary changes. Make sure to replace the <strong>mymail@myawesomedomain.tld <\/strong>and <strong>recipient@domain.tld <\/strong>with your existing domain and <strong>My$tr0ngPa55w0rd!<\/strong> with your email account password.<\/li>\n<\/ol><pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">&lt;?php\n   require 'vendor\/autoload.php';\n   use PHPMailer\\PHPMailer\\PHPMailer;\n   $mail = new PHPMailer;\n   $mail-&gt;isSMTP();\n   $mail-&gt;SMTPDebug = 2;\n   $mail-&gt;Host = 'smtp.hostinger.com';\n   $mail-&gt;Port = 587;\n   $mail-&gt;SMTPAuth = true;\n   $mail-&gt;Username = 'mymail@myawesomedomain.tld';\n   $mail-&gt;Password = 'My$tr0ngPa55w0rd!';\n   $mail-&gt;setFrom('mymail@myawesomedomain.tld', 'Your Name');\n   $mail-&gt;addReplyTo('mymail@myawesomedomain.tld', 'Your Name');\n   $mail-&gt;addAddress('recipient@domain.tld', 'Receiver Name');\n   $mail-&gt;Subject = 'Checking if PHPMailer works';\n   $mail-&gt;msgHTML(file_get_contents('message.html'), __DIR__);\n   $mail-&gt;Body = 'This is just a plain text message body';\n   \/\/$mail-&gt;addAttachment('attachment.txt');\n   if (!$mail-&gt;send()) {\n       echo 'Mailer Error: ' . $mail-&gt;ErrorInfo;\n   } else {\n       echo 'The email message was sent.';\n   }\n?&gt;<\/pre><ol start=\"6\" class=\"wp-block-list\">\n<li>After editing the code, click <strong>Save &amp; Close<\/strong>. To execute the script, enter <strong>yourdomain.tld\/phpmailer.php<\/strong> in your web browser.<\/li>\n<\/ol><p>\n\n\n<div class=\"protip\">\n                    <h4 class=\"title\">Configuring Titan SMTP<\/h4>\n                    <p>If you're using Titan Mail, connect via port <strong>465<\/strong> (SSL) or <strong>587<\/strong> (STARTTLS). Visit <strong>Emails &rarr; Configure Desktop App<\/strong> to see your <a href=\"https:\/\/support.hostinger.com\/en\/articles\/5966022-how-to-get-email-account-configuration-details-for-titan-email\" target=\"_blank\" rel=\"noopener\">email account configuration details<\/a>. You can also check <a href=\"https:\/\/support.titan.email\/hc\/en-us\/articles\/900000215446-Configure-Titan-on-other-apps-using-IMAP-POP\" target=\"_blank\" rel=\"noopener\"> Titan's official tutorial<\/a> to get the correct SMTP, IMAP, or POP settings.<\/p>\n                <\/div>\n\n\n\n<\/p><h3 class=\"wp-block-heading\" id=\"h-creating-a-phpmailer-contact-form\">Creating a PHPMailer contact form<\/h3><p>In addition to sending simple PHP mail, PHPMailer lets users create various contact forms, such as feedback surveys.<\/p><p>Like previous PHP scripts, create a new PHP file in the <strong>public_html<\/strong> folder and name it <strong>formscript.php<\/strong>. Copy and paste the script below into the new file and modify the values accordingly:<\/p><pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">&lt;?php\nuse PHPMailer\\PHPMailer\\PHPMailer;\n$msg = '';\nif (array_key_exists('email', $_POST)) {\n    require 'vendor\/autoload.php';\n    $mail = new PHPMailer;\n    $mail-&gt;isSMTP();\n    $mail-&gt;Host = 'smtp.hostinger.com';\n    $mail-&gt;Port = 587;\n    $mail-&gt;SMTPDebug = 0;\n    $mail-&gt;SMTPAuth = true;\n    $mail-&gt;Username = 'mymail@myawesomedomain.tld';\n    $mail-&gt;Password = 'My$tr0ngPa55w0rd!';\n    $mail-&gt;setFrom('mymail@myawesomedomain.tld', 'Mr. Snuffles');\n    $mail-&gt;addAddress('recipient@domain.tld', 'Receiver Name');\n    if ($mail-&gt;addReplyTo($_POST['email'], $_POST['name'])) {\n        $mail-&gt;Subject = 'PHPMailer contact form';\n        $mail-&gt;isHTML(false);\n        $mail-&gt;Body = &lt;&lt;&lt;EOT\n            Email: {$_POST['email']}\n            Name: {$_POST['name']}\n            Message: {$_POST['message']}\nEOT;\n        if (!$mail-&gt;send()) {\n            $msg = 'Sorry, something went wrong. Please try again later.';\n        } else {\n            $msg = 'Message sent! Thanks for contacting us.';\n        }\n    } else {\n        $msg = 'Share it with us!';\n    }\n}\n?&gt;\n\n&lt;!DOCTYPE html&gt;\n&lt;html lang=\"en\"&gt;\n&lt;head&gt;\n    &lt;meta charset=\"UTF-8\"&gt;\n    &lt;title&gt;Contact form&lt;\/title&gt;\n&lt;\/head&gt;\n&lt;body&gt;\n&lt;h1&gt;Contact us&lt;\/h1&gt;\n&lt;?php if (!empty($msg)) {\n    echo \"&lt;h2&gt;$msg&lt;\/h2&gt;\";\n} ?&gt;\n&lt;form method=\"POST\"&gt;\n    &lt;label for=\"name\"&gt;Name: &lt;input type=\"text\" name=\"name\" id=\"name\"&gt;&lt;\/label&gt;&lt;br&gt;\n    &lt;label for=\"email\"&gt;Email address: &lt;input type=\"email\" name=\"email\" id=\"email\"&gt;&lt;\/label&gt;&lt;br&gt;\n    &lt;label for=\"message\"&gt;Message: &lt;textarea name=\"message\" id=\"message\" rows=\"8\" cols=\"20\"&gt;&lt;\/textarea&gt;&lt;\/label&gt;&lt;br&gt;\n    &lt;input type=\"submit\" value=\"Send\"&gt;\n&lt;\/form&gt;\n&lt;\/body&gt;\n&lt;\/html&gt;<\/pre><p>\n\n\n<div class=\"protip\">\n                    <h4 class=\"title\">Pro tip<\/h4>\n                    <p>Taking user input from <strong>&#8203;&#8203;$_POST<\/strong> and using it unsanitized is not safe due to <strong>cross-site scripting (XSS)<\/strong> attacks. To avoid this, check out the <a href=\"https:\/\/www.geeksforgeeks.org\/what-are-the-best-input-sanitizing-functions-in-php\/\" target=\"_blank\" rel=\"noopener\">best practices for PHP variable sanitization<\/a>.<\/p>\n                <\/div>\n\n\n\n<\/p><p>Save your changes and run the script from your browser.<\/p><p>Here&rsquo;s what the result will look like:<\/p><div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><a href=\"\/ph\/tutorials\/wp-content\/uploads\/sites\/2\/2023\/05\/Contact-Us-form-example.png\"><img decoding=\"async\" width=\"726\" height=\"605\" src=\"\/tutorials\/wp-content\/uploads\/sites\/2\/2023\/05\/Contact-Us-form-example.png\" alt=\"Contact Us form example\" class=\"wp-image-85517\" srcset=\"https:\/\/www.hostinger.com\/ph\/tutorials\/wp-content\/uploads\/sites\/44\/2023\/05\/Contact-Us-form-example.png 726w, https:\/\/www.hostinger.com\/ph\/tutorials\/wp-content\/uploads\/sites\/44\/2023\/05\/Contact-Us-form-example-300x250.png 300w, https:\/\/www.hostinger.com\/ph\/tutorials\/wp-content\/uploads\/sites\/44\/2023\/05\/Contact-Us-form-example-150x125.png 150w\" sizes=\"(max-width: 726px) 100vw, 726px\" \/><\/a><\/figure><\/div><p>If a visitor submits a message via the form, they will get a confirmation. The form&rsquo;s content will be sent to the email address you entered here:<\/p><pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">$mail-&gt;addAddress('recipient@domain.tld', 'Receiver Name');<\/pre><p>\n\n\n<div class=\"protip\">\n                    <h4 class=\"title\">Pro tip<\/h4>\n                    <p>If the PHPMailer contact form doesn&rsquo;t work, change the <strong>$mail-&gt;SMTPDebug = 0;<\/strong> line to <strong>$mail-&gt;SMTPDebug = 2<\/strong> to identify the cause. Don't forget to remove the line or change the <strong>2<\/strong> to <strong>0<\/strong> after.<\/p>\n                <\/div>\n\n\n\n<\/p><p>Visit<a href=\"https:\/\/github.com\/PHPMailer\/PHPMailer\/tree\/master\/examples\" target=\"_blank\" rel=\"noopener\"> PHPMailer&rsquo;s official repository<\/a> on GitHub to check out other examples of how to use this mail-sending library.<\/p><p>If you&rsquo;re a WordPress user, use a <a href=\"\/ph\/tutorials\/wordpress-contact-form-plugins\">contact form plugin<\/a> like <strong>Formidable Forms<\/strong>, <strong>Contact Form 7<\/strong>, or <strong>WPForms <\/strong>to streamline the form-building process.<\/p><h2 class=\"wp-block-heading\" id=\"h-how-to-send-emails-using-the-php-mail-function\"><strong>How to send emails using the PHP mail() function<\/strong><\/h2><p>Another method to send emails directly from PHP is the built-in <strong>mail() <\/strong>function. To use the PHP mailer feature, users hosting their PHP application or site on a local server will need to configure a <strong>Sendmail<\/strong> program by changing the<strong> <\/strong><a href=\"\/ph\/tutorials\/what-is-php-ini\/\"><strong>php.ini<\/strong> file<\/a> in their PHP installation folder.<\/p><p>If you use a hosting server, <strong>Sendmail<\/strong> usually comes already pre-configured. However, you must ensure that your hosting provider allows you to manage the <strong>Sendmail service<\/strong> option manually.<\/p><p>By default, the <strong>Sendmail<\/strong> service is already enabled. Nevertheless, double-check to be sure.<\/p><p>\n\n\n<div><p class=\"important\"><strong>Important!<\/strong> Titan Mail enables the PHP <strong>mail()<\/strong> function by default. Thus, you can&rsquo;t switch it on or off in hPanel.<\/p><\/div>\n\n\n\n<\/p><h3 class=\"wp-block-heading\" id=\"h-understanding-php-mail-components\">Understanding PHP Mail components<\/h3><p>To help you understand the PHP <strong>mail() <\/strong>function, we&rsquo;ll review the components of the PHP script used in the previous section.<\/p><pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">ini_set( 'display_errors', 1 );\nerror_reporting( E_ALL );<\/pre><p>The first two lines above enable error reporting to inform you if the PHP script has failed to execute.<\/p><pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">$from = \"mymail@myawesomedomain.tld\";<\/pre><p>This line contains the sender&rsquo;s email address. Most hosting providers forbid adding random email addresses here due to <a href=\"https:\/\/www.malwarebytes.com\/spoofing\/\" target=\"_blank\" rel=\"noopener\">spoofing<\/a> risk. Therefore, it&rsquo;s better to use one with your domain name to execute the script successfully.<\/p><pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">$to = \"recipient@domain.tld\";<\/pre><p>The recipient&rsquo;s email address goes here. Separate the email addresses with commas if you want to send multiple emails.<\/p><pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">$subject = \"Checking PHP mail\";<\/pre><p>Enter the email subject line here.<\/p><pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">$message = \"PHP mail works just fine\";<\/pre><p>Here, input the body of your email message.<\/p><pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">$headers = \"From:\" . $from;<\/pre><p>This line is commonly used to include additional headers like <strong>From<\/strong>, <strong>Reply-To<\/strong>, and <strong>Cc<\/strong>. You can separate them with the <a href=\"https:\/\/developer.mozilla.org\/en-US\/docs\/Glossary\/CRLF\" target=\"_blank\" rel=\"noopener\">CRLF<\/a>.<\/p><pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">if (mail ($to,$subject,$message,$headers))<\/pre><p>This script executes the <strong>mail()<\/strong> function and checks whether it has run successfully.<\/p><pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">echo \"The email message was sent.\";<\/pre><p>The message above will appear if the <strong>mail()<\/strong> function is executed successfully.<\/p><pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">echo \"The email message was not sent.\";<\/pre><p>Alternatively, you will see this message if the <strong>mail()<\/strong> function fails.<\/p><p>Although additional headers are optional, it&rsquo;s essential to include the <strong>From <\/strong>header when sending mail. Otherwise, you&rsquo;ll receive a notification like this:<\/p><pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">Warning: mail(): \"sendmail_from\" not set in php.ini or custom \"From:\" header missing.<\/pre><p>For more information about the <strong>Sendmail <\/strong>function and its parameters, refer to the <a href=\"http:\/\/php.net\/manual\/en\/function.mail.php\" target=\"_blank\" rel=\"noopener\">official PHP documentation<\/a>.<\/p><h3 class=\"wp-block-heading\" id=\"h-creating-a-test-file-for-php-mail\">Creating a test file for PHP Mail<\/h3><p>After assuring that <strong>Sendmail<\/strong> is active, create a PHP mail file inside the <strong>public_html <\/strong>directory.<\/p><p>Here&rsquo;s how to do it:<\/p><ol class=\"wp-block-list\">\n<li>From <strong>hPanel<\/strong>, navigate to<strong> Files <\/strong>&rarr; <strong>File Manager <\/strong>to access <strong>Hostinger&rsquo;s File Manager<\/strong>.<\/li>\n\n\n\n<li>Double-click the <strong>public_html<\/strong> folder and select the <strong>New File <\/strong>icon at the top. Name this new file <strong>testmail.php<\/strong> and hit <strong>Create<\/strong>.<\/li>\n\n\n\n<li>Double-click on <strong>testmail.php<\/strong> to edit it. You can use the basic PHP code below but change the parameters accordingly. We&rsquo;ll describe the script components in more detail in the following subsection:<\/li>\n<\/ol><pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">&lt;?php\nini_set( 'display_errors', 1 );\nerror_reporting( E_ALL );\n$from = \"mymail@myawesomedomain.tld\";\n$to = \"recipient@domain.tld\";\n$subject = \"Checking PHP mail\";\n$message = \"PHP mail works just fine\";\n$headers = \"From:\" . $from;\nif(mail($to,$subject,$message, $headers)) {\n    echo \"The email message was sent.\";\n} else {\n    echo \"The email message was not sent.\";\n}\n?&gt;<\/pre><ol start=\"4\" class=\"wp-block-list\">\n<li>Click <strong>Save &amp; Close <\/strong>once finished.<\/li>\n\n\n\n<li>Send the email by accessing <strong>yourdomain\/testmail.php<\/strong> from your web browser. Remember to change <strong>&ldquo;yourdomain&rdquo;<\/strong> to the domain used when creating <strong>testmail.php<\/strong>.<\/li>\n<\/ol><h3 class=\"wp-block-heading\" id=\"h-sending-html-emails-with-php\">Sending HTML emails with PHP<\/h3><p>PHP <strong>mail() <\/strong>function can also be used to send an HTML email. This format is highly customizable compared to a plain text message.<\/p><p>The process to send HTML mail is the same, but you need to include an HTML message and additional parameter headers this time.<\/p><p>Here is an example of a basic script to send an HTML email:<\/p><pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">&lt;?php\n   ini_set( 'display_errors', 1 );\n   error_reporting( E_ALL );\n   $from = \"mymail@myawesomedomain.tld\";\n   $to = \"recipient@domain.tld\";\n   $subject = \"Checking PHP mail\";\n   $message = \"\n   &lt;html&gt;\n   &lt;head&gt;\n       &lt;title&gt;This is a test HTML email&lt;\/title&gt;\n   &lt;\/head&gt;\n   &lt;body&gt;\n       &lt;p&gt;Hi, it's a test email. Please ignore.&lt;\/p&gt;\n   &lt;\/body&gt;\n   &lt;\/html&gt;\n   \";\n  \/\/ The content-type header must be set when sending HTML email\n   $headers = \"MIME-Version: 1.0\" . \"\\r\\n\";\n   $headers .= \"Content-type:text\/html;charset=UTF-8\" . \"\\r\\n\";\n   $headers = \"From:\" . $from;\n   if(mail($to,$subject,$message, $headers)) {\n      echo \"Message was sent.\";\n   } else {\n      echo \"Message was not sent.\";\n   }\n?&gt;<\/pre><h2 class=\"wp-block-heading\" id=\"h-how-to-troubleshoot-common-php-mail-and-phpmailer-errors\"><strong>How to troubleshoot common PHP mail and PHPMailer errors<\/strong><\/h2><p>In the following section, we&rsquo;ll review some of the most common issues that might occur when using the PHP<strong> mail() <\/strong>function or PHPMailer and how to fix them.<\/p><h3 class=\"wp-block-heading\" id=\"h-sender-address-rejected-not-owned-by-the-user\"><strong>Sender address rejected: not owned by the user<\/strong><\/h3><p>This error means the server could not authenticate the sender using the provided details. To fix it, check the email address you&rsquo;ve used to send the message and ensure it corresponds to an existing one.<\/p><p>Also, make sure your <strong>Sender Policy Framework (SPF)<\/strong> is enabled. If you use Hostinger, check your SPF record by going to <strong>hPanel<\/strong>, and navigating to <strong>Emails <\/strong>&rarr; <strong>Email Accounts <\/strong>&rarr; <strong>DNS settings<\/strong> &rarr; <strong>Manage Email Delivery<\/strong>.<\/p><p>If the SPF record is enabled, it will be shown as <strong>Active.<\/strong><\/p><h3 class=\"wp-block-heading\" id=\"h-gmail-couldn-t-verify-that-domain-tld-sent-this-message\"><strong>Gmail couldn&rsquo;t verify that domain.tld sent this message<\/strong><\/h3><p>If you see this warning when testing a PHP mail script, the cause might be one of the following:<\/p><ul class=\"wp-block-list\">\n<li><strong>There is no SPF record in the domain&rsquo;s DNS Zone<\/strong>. If the record is missing, or you&rsquo;re using external nameservers, add a new SPF TXT record manually via hPanel or cPanel.<\/li>\n\n\n\n<li><strong>You used invalid SMTP authentication details<\/strong>. Make sure to use an existing email address that belongs to you.<\/li>\n<\/ul><h3 class=\"wp-block-heading\" id=\"h-mail-goes-to-the-spam-folder\"><strong>Mail goes to the spam folder<\/strong><\/h3><p>There are various reasons why PHP mail might trigger spam filters. Some of the most common causes include:<\/p><ul class=\"wp-block-list\">\n<li><strong>Misleading or spam-like subject. <\/strong>It usually happens when using terms such as &ldquo;test&rdquo; or &ldquo;urgent.&rdquo; Be sure to set a clear intent in the <strong>Subject<\/strong> line.<\/li>\n\n\n\n<li><strong>Incorrect sender address.<\/strong> Adding the wrong address can invoke security measures to filter your email to prevent spoofing and scams.<\/li>\n\n\n\n<li><strong>Using spam trigger words.<\/strong> Remove spammy words like &ldquo;a great offer&rdquo; and &ldquo;this is not spam&rdquo; from your message to increase your email&rsquo;s credibility.<\/li>\n\n\n\n<li><strong>Your mailing list doesn&rsquo;t have an unsubscribe link.<\/strong> Ensure to include an unsubscribe button to prevent this issue and build reader trust.<\/li>\n<\/ul><h3 class=\"wp-block-heading\" id=\"h-could-not-connect-to-smtp-host\"><strong>Could not connect to SMTP host<\/strong><\/h3><p>Newer PHP versions usually have stricter SSL behavior. If the PHP <strong>mail()<\/strong> function fails to execute after updating your PHP to the latest version, this might be what causes it.<\/p><p>Using PHPMailer with some hosting providers usually triggers this code error as well.<\/p><p>For example, according to the <a href=\"https:\/\/github.com\/PHPMailer\/PHPMailer\/wiki\/Troubleshooting#php-56-certificate-verification-failure\" target=\"_blank\" rel=\"noopener\">PHPMailer wiki<\/a>, GoDaddy blocks outbound SMTP connections via ports 25, 465, and 587 to third-party servers like Gmail and Hotmail except their own. Furthermore, it doesn&rsquo;t support integration with third-party SMTP servers.<\/p><p>Use the following script to resolve this error:<\/p><pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">$mail-&gt;SMTPOptions = array( \n'ssl' =&gt; array( \n'verify_peer' =&gt; false, \n'verify_peer_name' =&gt; false, \n'allow_self_signed' =&gt; true \n) \n);<\/pre><p>\n\n\n<div><p class=\"important\"><strong>Important!<\/strong> Avoid implementing these changes globally in <strong>php.ini<\/strong>, as doing so allows insecure connections, a security issue that PHP addressed since version 5.6. <\/p><\/div>\n\n\n\n<\/p><p>As Hostinger SMTP doesn&rsquo;t have this issue, consider migrating to our <a href=\"\/ph\/business-email\">business email service<\/a> for a better mailing experience.<\/p><?xml encoding=\"utf-8\" ?><figure class=\"wp-block-image size-large\"><a href=\"\/ph\/business-email\" target=\"_blank\" rel=\"noreferrer noopener\"><img decoding=\"async\" width=\"1024\" height=\"300\" src=\"https:\/\/www.hostinger.com\/tutorials\/wp-content\/uploads\/sites\/2\/2023\/02\/Email-hosting-cta-banner-1024x300.png\" alt=\"\" class=\"wp-image-77916\" srcset=\"https:\/\/www.hostinger.com\/ph\/tutorials\/wp-content\/uploads\/sites\/44\/2023\/02\/Email-hosting-cta-banner.png 1024w, https:\/\/www.hostinger.com\/ph\/tutorials\/wp-content\/uploads\/sites\/44\/2023\/02\/Email-hosting-cta-banner-300x88.png 300w, https:\/\/www.hostinger.com\/ph\/tutorials\/wp-content\/uploads\/sites\/44\/2023\/02\/Email-hosting-cta-banner-150x44.png 150w, https:\/\/www.hostinger.com\/ph\/tutorials\/wp-content\/uploads\/sites\/44\/2023\/02\/Email-hosting-cta-banner-768x225.png 768w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/a><\/figure><h2 class=\"wp-block-heading\" id=\"h-conclusion\">Conclusion<\/h2><p>You can send emails with PHP using either the<strong> mail() <\/strong>function or a mail-sending library like PHPMailer. The former is suitable for sending small volumes of simple text-based messages, whereas the latter is better for sending bulk emails or creating contact forms.<\/p><p>You can leverage the built-in PHP mail function by creating a new PHP file in the <strong>public_html <\/strong>directory and executing the script in it using your web browser.<\/p><p>On the other hand, sending emails with PHPMailer requires installing the code library via Composer, setting up an email account for it, and configuring your hosting&rsquo;s SMTP settings.<\/p><p>In this tutorial, we went over installing PHPMailer, creating a test script, and setting up a simple contact form. We also covered the process of sending emails with the PHP <strong>mail()<\/strong> function and how to troubleshoot common errors during the email-sending process.<\/p><p>We hope you found this tutorial useful. If you have any further questions, leave them in the comments section below.<\/p><h2 class=\"wp-block-heading\" id=\"h-php-mail-faq\">PHP Mail FAQ<\/h2><p>This section will answer some of the most frequently asked questions about PHP mail.<\/p><div class=\"schema-faq wp-block-yoast-faq-block\"><div class=\"schema-faq-section\" id=\"faq-question-1684126560647\"><h3 class=\"schema-faq-question\"><strong>Can I send emails from PHPMailer to Gmail or other email services?<\/strong><\/h3> <p class=\"schema-faq-answer\">It depends on your hosting provider. With GoDaddy, you can&rsquo;t send mail to inboxes that implement SPF and DKIM email authentication protocols like Gmail, Yahoo, and Hotmail. However, this issue doesn&rsquo;t persist with Hostinger. Contact your web host to clarify its SMTP settings and whether it supports PHPMailer with third-party SMTP servers.<\/p> <\/div> <div class=\"schema-faq-section\" id=\"faq-question-1684126576498\"><h3 class=\"schema-faq-question\"><strong>How can I validate email addresses before using the PHP mail() function or PHPMailer to send emails?<\/strong><\/h3> <p class=\"schema-faq-answer\">You can use the <strong>filter_var()<\/strong> function and pass the email address to the <strong>FILTER_VALIDATE_EMAIL<\/strong> filter. This filter will verify the email&rsquo;s validity, ensuring it doesn&rsquo;t contain any unsupported characters or white spaces.<\/p> <\/div> <\/div>\n","protected":false},"excerpt":{"rendered":"<p>Most businesses choose to create a professional email account to boost their credibility and build customer trust. To accomplish this, you just need to buy a domain and set up your business email on an email client or a server. If you build your website or web application with the PHP programming language, you can [&#8230;]<\/p>\n<p><a class=\"btn btn-secondary understrap-read-more-link\" href=\"\/ph\/tutorials\/send-emails-using-php-mail\">Read More&#8230;<\/a><\/p>\n","protected":false},"author":115,"featured_media":69236,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"rank_math_title":"How to Send Emails with PHP Mail() Function and PHP Mailer","rank_math_description":"In this guide, we'll show you how to send emails using the PHP mail feature using the inbuilt PHP mail() function or PHPMailer.","rank_math_focus_keyword":"php mail, php mail() function","footnotes":""},"categories":[22631,22623,22625],"tags":[],"class_list":["post-685","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-email","category-hosting","category-technical-aspects"],"hreflangs":[],"_links":{"self":[{"href":"https:\/\/www.hostinger.com\/ph\/tutorials\/wp-json\/wp\/v2\/posts\/685","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.hostinger.com\/ph\/tutorials\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.hostinger.com\/ph\/tutorials\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.hostinger.com\/ph\/tutorials\/wp-json\/wp\/v2\/users\/115"}],"replies":[{"embeddable":true,"href":"https:\/\/www.hostinger.com\/ph\/tutorials\/wp-json\/wp\/v2\/comments?post=685"}],"version-history":[{"count":113,"href":"https:\/\/www.hostinger.com\/ph\/tutorials\/wp-json\/wp\/v2\/posts\/685\/revisions"}],"predecessor-version":[{"id":122626,"href":"https:\/\/www.hostinger.com\/ph\/tutorials\/wp-json\/wp\/v2\/posts\/685\/revisions\/122626"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.hostinger.com\/ph\/tutorials\/wp-json\/wp\/v2\/media\/69236"}],"wp:attachment":[{"href":"https:\/\/www.hostinger.com\/ph\/tutorials\/wp-json\/wp\/v2\/media?parent=685"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.hostinger.com\/ph\/tutorials\/wp-json\/wp\/v2\/categories?post=685"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.hostinger.com\/ph\/tutorials\/wp-json\/wp\/v2\/tags?post=685"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}