Hi guys tanong ko lang eto kasi yung code ko sa sendemail.php
<?php
require 'PHPMailer-master/PHPMailerAutoload.php';
$body = $_REQUEST['body'];
$email = $_REQUEST['email'];
$mail = new PHPMailer;
//$mail->SMTPDebug = 3; // Enable verbose debug output
$mail->isSMTP(); // Set mailer to use SMTP
$mail->Host = 'smtp.gmail.com'; // Specify main and backup SMTP servers
$mail->SMTPAuth = true; // Enable SMTP authentication
$mail->Username = '[email protected]'; // SMTP username
$mail->Password = 'PASSWORD'; // SMTP password
$mail->SMTPSecure = 'tls'; // Enable TLS encryption, `ssl` also accepted
$mail->Port = 587; // TCP port to connect to
$mail->setFrom('$email', 'AMPS Mailer');
$mail->addAddress('[email protected]', 'Network Admin'); // Add a recipient
//$mail->addAddress(''); // Name is optional
//$mail->addReplyTo('[email protected]', 'Network Admin');
$mail->addCC('');
$mail->addBCC('');
$mail->addAttachment('/var/tmp/file.tar.gz'); // Add attachments
$mail->addAttachment('/tmp/image.jpg', 'new.jpg'); // Optional name
$mail->isHTML(true); // Set email format to HTML
$mail->Subject = 'Proposal Request | AMPS Interconnect, Inc.';
$mail->Body = '$body';
//$mail->AltBody = '$body';
if(!$mail->send()) {
echo 'Message could not be sent.';
echo 'Mailer Error: ' . $mail->ErrorInfo;
} else {
echo 'Message has been sent';
}
?>
Kaya lang hindi niya nakukuha yung value dun sa form.php
<form id="main-contact-form" name="contact-form" method="post" action="sendemail.php">
<div class="form-group">
<input type="text" name="name" id="name" class="form-control" placeholder="Name" required>
</div>
<div class="form-group">
<input type="email" name="email" id="email" class="form-control" placeholder="Email" required>
</div>
<div class="form-group">
<input type="text" name="subject" id="subject" class="form-control" placeholder="Subject" required>
</div>
<div class="form-group">
<textarea name="message" id="message" class="form-control" rows="8" placeholder="Message" required></textarea>
</div>
<button type="submit" class="btn btn-primary">Send Message</button>
</form>
Ano kaya possible na problem?
<?php
require 'PHPMailer-master/PHPMailerAutoload.php';
$body = $_REQUEST['body'];
$email = $_REQUEST['email'];
$mail = new PHPMailer;
//$mail->SMTPDebug = 3; // Enable verbose debug output
$mail->isSMTP(); // Set mailer to use SMTP
$mail->Host = 'smtp.gmail.com'; // Specify main and backup SMTP servers
$mail->SMTPAuth = true; // Enable SMTP authentication
$mail->Username = '[email protected]'; // SMTP username
$mail->Password = 'PASSWORD'; // SMTP password
$mail->SMTPSecure = 'tls'; // Enable TLS encryption, `ssl` also accepted
$mail->Port = 587; // TCP port to connect to
$mail->setFrom('$email', 'AMPS Mailer');
$mail->addAddress('[email protected]', 'Network Admin'); // Add a recipient
//$mail->addAddress(''); // Name is optional
//$mail->addReplyTo('[email protected]', 'Network Admin');
$mail->addCC('');
$mail->addBCC('');
$mail->addAttachment('/var/tmp/file.tar.gz'); // Add attachments
$mail->addAttachment('/tmp/image.jpg', 'new.jpg'); // Optional name
$mail->isHTML(true); // Set email format to HTML
$mail->Subject = 'Proposal Request | AMPS Interconnect, Inc.';
$mail->Body = '$body';
//$mail->AltBody = '$body';
if(!$mail->send()) {
echo 'Message could not be sent.';
echo 'Mailer Error: ' . $mail->ErrorInfo;
} else {
echo 'Message has been sent';
}
?>
Kaya lang hindi niya nakukuha yung value dun sa form.php
<form id="main-contact-form" name="contact-form" method="post" action="sendemail.php">
<div class="form-group">
<input type="text" name="name" id="name" class="form-control" placeholder="Name" required>
</div>
<div class="form-group">
<input type="email" name="email" id="email" class="form-control" placeholder="Email" required>
</div>
<div class="form-group">
<input type="text" name="subject" id="subject" class="form-control" placeholder="Subject" required>
</div>
<div class="form-group">
<textarea name="message" id="message" class="form-control" rows="8" placeholder="Message" required></textarea>
</div>
<button type="submit" class="btn btn-primary">Send Message</button>
</form>
Ano kaya possible na problem?