Symbianize Forum

Most of our features and services are available only to members, so we encourage you to login or register a new account. Registration is free, fast and simple. You only need to provide a valid email. Being a member you'll gain access to all member forums and features, post a message to ask question or provide answer, and share or find resources related to mobile phones, tablets, computers, game consoles, and multimedia.

All that and more, so what are you waiting for, click the register button and join us now! Ito ang website na ginawa ng pinoy para sa pinoy!

PHPMailerAutoload

kenett

Apprentice
Advanced Member
Messages
77
Reaction score
0
Points
26
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?
 
wala akong nakita na kinukuha mo yung post galing sa form gaya ng subject, message

$body = $_REQUEST['body']; //dko alam anu to, ito ba ang message galing sa form?
$email = $_REQUEST['email']; //palitan mo kaya ng $_POST, ito ba yung galing sa input mo?

gaya nito

//new
$email = filter_input(INPUT_POST, 'email');

//same lahat....
//$name=filter_input(INPUT_POST, 'name');
//$subject=filter_input(INPUT_POST, 'subject');
//$message=filter_input(INPUT_POST, 'message');

//or---

//old
$email=$_POST['email'];

//same lahat....
//$name=$_POST['name'];
//$subject=$_POST['subject'];
//$message=$_POST['message'];


$mail->Subject = $subject;
$mail->Body = $message;
 
Last edited:
hindi mo naman kinukuha yung value ng isesend mo.

parang ganito:

Sa sendemail.php eto.
$message = $_POST['message'];

Sa form.php
<input id="message" type="hidden" name="message">
 
bat naman naka hidden ang message?
<input id="message" type="hidden" name="message">
eh di hindi yan makikita at di malalagyan ng input. Liban nalang kung may default message value yan.
 
Hi, ako din may ilan sa mga code ko hindi nag work baka meron kayon alam zip file for PHPMailerAutoload.php or package na
 
Back
Top Bottom