Remember this information as you will use it to send mail via PHPMailer. Fill in the new email address and set a password.Create an email account by accessing the hPanel, then going to Emails → Email Accounts → Create email account.If you are using Titan Mail, use its SMTP server instead. This line contains the mail message body. $mail->Body = 'This is just a plain text message body' The file_get_contents() function will load the content from message.html, a local file located in the public_html directory, and include it in the message. This line reads an HTML message body from an external file. $mail->msgHTML(file_get_contents('message.html'), _DIR_) $mail->Subject = 'Checking if PHPMailer works' Īdd the email’s subject line here. This line will let the recipient know which address they should reply to. This is where you insert the sender’s email address. $mail->Username = your email address here. This line is used to turn on SMTP authentication. This is where the SMTP server address should be specified. The SMTPDebug command lets you detect if something goes wrong with the SMTP connection. The code here tells PHPMailer class to use the custom SMTP configuration defined in the script instead of the local mail server. This line includes various libraries that PHPMailer needs. The line above imports the PHPMailer class to the global namespace. To understand how PHPMailer works, let’s review each script component above. Wait a moment until the installation process is finished.Execute the following command to navigate to the public_html directory:.Remember that PuTTY will not display the password, so don’t be surprised if it doesn’t appear on the screen. Once a command window appears, type in your SSH username and password and hit Enter.Open PuTTY and enter your SSH information in the Host Name (or IP address) and Port fields.From your hPanel dashboard, go to Advanced → SSH Access and take note of the SSH IP, port, username, and password under the SSH details.Connect to your account via an SSH client.To install PHPMailer manually, follow these steps: Otherwise, if you need a newer version or your PHP version is 8+, use the composer2 command. If you need an older Composer version, use the composer command. Our shared and cloud hosting plans include two versions of this software. Installing PHPMailer is quite simple, especially if you have Composer installed. It gives access to a set of functions for sending emails, simplifying the process of configuring PHP mail. PHPMailer is a popular mail-sending library that supports sending via the mail() function or through an SMTP server. It does take a while to get used to and learn the logic.Can be used to send high amounts of emails in a short period.Supports SMTP, and authentication is integrated over SSL and TLS.Introduces complex email structures, such as HTML documents and attachments.Therefore, external libraries such as PHPMailer are recommended instead Thus, using only a mail() function isn’t sufficient. Sending an email is a complicated process.Not suitable for sending a large number of emails. ![]()
0 Comments
Leave a Reply. |