0

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/masterlink.co.id/www/cgoods/send_email.php 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/masterlink.co.id/www/cgoods/send_email.php on line 40

send_email.php

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
</head>

<body>


<?php 

$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'] : ''; 

?>  

<?php
// 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 />

<?php

require("PHPMailer5\class.phpmailer.php"); 
$mail = new PHPMailer(); 
$mail->IsSMTP();
$mail->SMTPAuth = true;
$mail->SMTPSecure = 'SSL';
$mail->Host = 'smtp.mail.yahoo.com';
$mail->Port = 25; 
$mail->Username = 'david_yg20@yahoo.com';
$mail->Password = '*****';  
$mail->From='david_yg20@yahoo.com';
$mail->FromName="My site's mailer";
$mail->Body = $newcomments;
$mail->Sender='david_yg20@yahoo.com';
$mail->AddReplyTo("replies@example.com", "Replies for my site");
$mail->AddAddress("plasteezy@yahoo.com");
//$mail->Subject = $subject;
$mail->IsHTML(true);
#$mail->AddAttachment('http://www.branddesignexpress.com/images/homepage_mainimage.jpg', '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";
}
?>


</body>
</html>

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

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

4
Contributors
11
Replies
12
Views
5 Years
Discussion Span
Last Post by davy_yg
0

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.

0

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.

0

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

Edited by pritaeas: n/a

0

With :

$mail->SMTPSecure = 'SSL';
$mail->Host = 'smtp.mail.yahoo.com';
$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.

0

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

0

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

0

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

Edited by davy_yg: n/a

0

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?

Edited by davy_yg: n/a

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.