Tag Cloud

403 forbidden error a record addon domain authcode authorization Backup bandwidth blacklist bulkdomain bulkdomain purchasing change change password childnameservers client area clientlogin cloud hosting cname cname record combo combooffers comodo comodo EV multidomain SSL comodo EV SSL comodo multi domain SSL comodo positive SSL Control Panel cpanel crawlrate credentials curl cybersquatting Data Center data transfer database dedicate jvm dedicated server DHCP discount diskspace DNS domain domain abuse domain activation domain dot com free domain forwarding domain name domain parking domain pricing domain privacy domain propogation domain registration domain renewal domain resotration domain search domain sniping domain transfer domain validity domainauthority domin search dynamic Edit Profile email error expiry date filter flushcache flushdns ftp google googlebot graboffer grace period hacking hdd help hijacking homepage Host hostfile Hosting html icann information IP ipaddress issue java java hosting jsp letsencrypt LifeTime hosting linux linuxserver location login mac magento magento hosting mail mail config mail hosting maintenance migration Modify Profile monetized mx record mysql nameserver nameservers nodejs nodejs hosting nvme offer outlook page cannot be loaded phishing phpinfo phpmailer ping plesk pricing privacy private jvm propogation Rapid Positive SSL Rapid wildcard SSL rapidssl rdns refund registrant registration renewals reseller reseller hosting reseller hoting resetpassword resolving return and refund policy ruby rubyonrails saveyourdata serupemail server serverip servername settings setupemail sftp shared hosting sharedIP shell access sld smtp space spam spamming speed ssd ssh ssl staticIP storage subdomain subnet switch swuqtting terminal theft tld tomcat txt record unmetered Update Profile upgrade username verification vps vps hoting vpsplesk war file web hosting web space webdesign website whois windows windows hosting windowsvps wordpress hosting You are unable to ping your website because you may have updated your domain is still under the propagation period. Only when the zerbitzaria

How to enable mail function in PHP? Print

  • email, phpmailer
  • 0

Usually, mail function would be disabled.
 
Enabling mail function can cause various problems like receiving spam emails so it is not recommended.
 
Instead, you can use PHPMailer Function to send emails.
 

Send Mail in PHP using PHPMailer

How to use PhpMailer with SMTP authentication?

PhpMailer with SMTP Authentication

You can easily send mail through php with SMTP authentication using PhpMailer by following the step given below.
Step 1: First download the PHPMailer script using below direct link.
PHPMailer.zip
Step 2:
 Download and unzip the php mailer file under public_html folder.
Step 3: Once after extracting the file, your path will be public_html/PHPMailer.
Step 4: Use this PHPMailer script to send mail in your webpage.
Your PHP code will be as we shown below.

require_once ("/home/username/public_html/PHPMailer/class.phpmailer.php");
$mail = new PHPMailer();
$mail = new PHPMailer(true);
$mail->IsSMTP();
$mail->SMTPAuth = true;
$mail->Port = 25;
$mail->Host = "yourdomain.com"; // SMTP server
$mail->Username = "sending@yourdomain.com"; // SMTP account username
$mail->Password = "password"; // SMTP account password
$mail->From = "sending@yourdomain.com";
$mail->FromName = "Test";
$mail->AddAddress("receive@yourdomain.com"); // Receiving Mail ID, it can be either domain mail id (or ) any other mail id i.e., gmail id
$mail->Subject ="PhpMailer script with basic smtp authentication";
$mail->AltBody = " ";
$mail->WordWrap = 80;
$body = "test message";
$mail->MsgHTML($body);
$mail->IsHTML(true);
if(!$mail->send())
{
echo "Mailer Error: " . $mail->ErrorInfo;
}
else
{
echo "Message Sent!";
}

Note: If you are extracting the PHPMailer_5.2.4 under any name, then your path will be /home/username/public_html/anyname/class.phpmailer.php. The user name you have provided here is your cpanel user name.


Was this answer helpful?
Back