Demo Send Email

Kepada : Kamu
Subject : Additive
Pesan : Pesan
Dari : david

Warning: require(PHPMailer5\class.phpmailer.php) [function.require]: failed to open stream: No such file or directory in /home/sloki/user/masterli/sites/ on line 40

Fatal error: require() [function.require]: Failed opening required 'PHPMailer5\class.phpmailer.php' (include_path='.:/usr/share/php:/usr/share/pear') in /home/sloki/user/masterli/sites/ on line 40


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "">
<html xmlns="">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>



$nama = isset($_POST['nama']) ? $_POST['nama'] : '';
$email = isset($_POST['email']) ? $_POST['email'] : '';
$telepon = isset($_POST['telepon']) ? $_POST['telepon'] : '';
$subjek = isset($_POST['subjek']) ? $_POST['subjek'] : '';	  
$comments = isset($_POST['comments']) ? $_POST['comments'] : ''; 


// using htmlentities 

$newnama= htmlspecialchars($nama, ENT_QUOTES);
$newemail = htmlspecialchars($email, ENT_QUOTES);
$telepon = htmlspecialchars($telepon, ENT_QUOTES);
$newsubjek = htmlspecialchars($subjek, ENT_QUOTES);
$newcomments = htmlspecialchars($comments, ENT_QUOTES);  

<h1>Demo Send Email</h1><hr>

Kepada : Kamu  <br />
Subject : <?php echo $newsubjek; ?><br />
Pesan : <?php echo $newcomments; ?><br />
Dari : <?php echo $newnama; ?><br />


$mail = new PHPMailer(); 
$mail->SMTPAuth = true;
$mail->SMTPSecure = 'SSL';
$mail->Host = '';
$mail->Port = 25; 
$mail->Username = '';
$mail->Password = '*****';  
$mail->FromName="My site's mailer";
$mail->Body = $newcomments;
$mail->AddReplyTo("", "Replies for my site");
//$mail->Subject = $subject;
#$mail->AddAttachment('', 'homepage_mainimage.jpg');
$mail->AddEmbeddedImage('homepage_mainimage.jpg', 'logoimg', 'homepage_mainimage.jpg'); 
// attach file logo.jpg, and later link to it using identfier //logoimg$mail->Body = $msg;
$mail->AltBody="This is text only alternative body.";
if(!$mail->Send()){   echo "Error sending: " . $mail->ErrorInfo; 
}else{   echo "Letter is sent";


Line 40: require("PHPMailer5\class.phpmailer.php");

I wonder why it does not work, I already check and the file is there.

If that doesn't work, try not to use capitals, gave me quite some trouble a few years ago

Demo Send Email

Kepada : Kamu
Subject : Additive
Pesan : Pesan
Dari : David
Letter is sent

It appears to be ok. But when I checked my e-mail, no e-mail receive.

Just a suggestion, might be wrong but sure mail features is turned on? I had this problem when I was working on my own server, like WAMP or MAMP.

how to turn on the mail feature ?

I think yahoo's SSL SMTP port is 465 or 587, not 25. Check Yahoo's website to be sure.

With :

$mail->SMTPSecure = 'SSL';
$mail->Host = '';
$mail->Port = 465;

I get this error:

Demo Send Email

Kepada : Kamu
Subject : Additive
Pesan : Pesan
Dari : James
SMTP Error: Could not authenticate. Error sending: SMTP Error: Could not authenticate.

Maybe you need to send an username/password combination as well.
Try checking Yahoo's site, there should be plenty mail information.

Are you sure you are allowed to yahoo mail like that ? Do you have a plus account (or small business account) ?

I think my yahoo mail suppose to be standard yahoo e-mail. It's free e-mail account.

What are other alternative to the solution above?

Does the php manual explain anything about php mailer? I only find the mail function. Also, is defining the port always necessary?