Send email using Yahoo SMTP server from using PHP

In this post we will show you Send email using Yahoo SMTP server from using PHP, hear for Send email using Yahoo SMTP server from using PHP we will give you demo and example for implement.

Email Service providers have POP and SMTP servers for incoming and outgoing E-Mails. SMTP is for Outgoing (Sending) emails and POP is for Incoming (Receiving) emails. If you have an account in email services, it means that you can send or receive emails using these servers. This service is free, fast and secure. You can change the “From” address and the “From” name if you send emails using SMTP server. In this post I will tell you how to send emails using SMTP servers of Yahoo and gmail in PHP.

Yahoo SMTP Server Settings


Yahoo
Address : smtp.mail.yahoo.com
Port : 465
Security/Connection Type: ssl
AuthMode : login

Download Send email Yahoo SMTP server files




Hear is code for Send email using Yahoo SMTP server from using PHP you need to include class.phpmailer.php

require 'class.phpmailer.php';

$yahoo_mail = new PHPMailer;

$yahoo_mail->IsSMTP();    
// Send email using Yahoo SMTP server    
$yahoo_mail->Host = 'smtp.mail.yahoo.com'; 
// port for Send email
$yahoo_mail->Port = 465; 
$yahoo_mail->SMTPSecure = 'ssl';    
$yahoo_mail->SMTPDebug = 1; 
$yahoo_mail->SMTPAuth = true; 
$yahoo_mail->Username = 'your-Yahoo-address@Yahoo.com';
$yahoo_mail->Password = 'add-your-Yahoo-Password';

$yahoo_mail->From = 'your-Yahoo-address@Yahoo.com';
$yahoo_mail->FromName = 'Your From name';// frome name
$yahoo_mail->AddAddress('to-Yahoo-address@Yahoo.com', 'To Name');  // Add a recipient  to name 
$yahoo_mail->AddAddress('to-Yahoo-address@Yahoo.com');  // Name is optional

$yahoo_mail->IsHTML(true); // Set email format to HTML

$yahoo_mail->Subject = 'Here is the subject for onlinecode';
$yahoo_mail->Body    = 'Send email using Yahoo SMTP server <br>This is the HTML message body <strong>in bold!</strong> <a href="http://onlinecode.org/" target="_blank">onlincode.org</a>';
$yahoo_mail->AltBody = 'This is the body in plain text for non-HTML mail clients at http://onlinecode.org/';

if(!$yahoo_mail->Send()) {
   echo 'Message could not be sent.';
   echo 'Mailer Error: ' . $yahoo_mail->ErrorInfo;
   exit;
}
else
{
	echo 'Message of Send email using Yahoo SMTP server has been sent';
}




Hope this code and post will helped you for implement Send email using Yahoo SMTP server from using PHP. if you need any help or any feedback give it in comment section or you have good idea about this post you can give it comment section. Your comment will help us for help you more and improve onlincode. we will give you this type of more interesting post in featured also so, For more interesting post and code Keep reading our blogs onlincode.org