Good Day everyone who has an idea on how to get the message and add address using input fields.
public function send()
{
$this->load->library('phpmailer_lib');
try
{
$mail=$this->phpmailer_lib->load();
$mail->setFrom('rayjayabejuela@gmail.com','Rayjay');
$mail->addAddress('flutterrun@gmail.com'); // I want the input data came from the input fields of email.
$mail->Subject="Subject Matter";
$mailContent=''; I want the input data came from the input fields came from the message.
$mail->Body=$mailContent;
if($mail->send()){
echo "Email has been set";
}
}
catch(Exception $e){
echo $mail->ErrorInfo;
}
}
This is my view page page
<form action="<?php echo base_url(); ?>email/send" method="post">
<br>
<input type="email" name="email" class="form-control" placeholder="Enter Email" required>
<br>
<textarea name="message" class="form-control" placeholder="Enter message here" required></textarea>
<br>
<button type="submit" class="btn btn-primary">Send Message</button>
</form>
public function send()
{
$this->load->library('phpmailer_lib');
try
{
$email = $this->input->post('email');
$message = $this->input->post('message');
$mail=$this->phpmailer_lib->load();
$mail->setFrom('rayjayabejuela@gmail.com','Rayjay');
$mail->addAddress($email); // I want the input data came from the input fields of email.
$mail->Subject="Subject Matter";
$mailContent=$message; I want the input data came from the input fields came from the message.
$mail->Body=$mailContent;
if($mail->send()){
echo "Email has been set";
}
}
catch(Exception $e){
echo $mail->ErrorInfo;
}
}