In footer.twig my code for form goes like this :
Code: Select all
<form method="post" action="index.php?route=common/home/process1">
<div class="form-group">
<div class="row" style="margin:0px;">
<div class="col-sm-9">
<input type="email" id="newsletter_email" name="newsletter_email" class="form-control newsletter-input" required placeholder="Enter Your Email ID">
</div>
<div class="button col-sm-3">
<input type="submit" value="Submit" class="form-control newsletter-input" style="background-color: #ddf0dd;border: 1px solid black;">
</div>
</div>
</div>
</form>
Code: Select all
public function process1() {
$this->session->data['newsletter_email'] = strip_tags($this->request->post['newsletter_email']);
$mail = new Mail($this->config->get('config_mail_engine'));
$mail->parameter = $this->config->get('config_mail_parameter');
$mail->smtp_hostname = $this->config->get('config_mail_smtp_hostname');
$mail->smtp_username = $this->config->get('config_mail_smtp_username');
$mail->smtp_password = html_entity_decode($this->config->get('config_mail_smtp_password'), ENT_QUOTES, 'UTF-8');
$mail->smtp_port = $this->config->get('config_mail_smtp_port');
$mail->smtp_timeout = $this->config->get('config_mail_smtp_timeout');
$mail->setTo($this->config->get('config_email'));
$mail->setFrom($this->config->get('config_email'));
$mail->setSender(html_entity_decode($this->config->get('config_name'), ENT_QUOTES, 'UTF-8'));
$mail->setSubject(html_entity_decode($this->language->get('text_new_customer'), ENT_QUOTES, 'UTF-8'));
$mail->setText("TextHere");
$mail->send();
var_dump($mail);
$this->db->query("INSERT INTO `newsletter` SET email = '" . $this->db->escape($this->session->data['newsletter_email']) . "'");
//$this->response->redirect($this->url->link('checkout/success'));
//$this->response->addHeader('Content-Type: application/json');
//$this->response->setOutput(json_encode($json));
}
var_dump($mail) gives the following :
Any insight would be appreciated!object(Mail)#103 (15) { ["to":protected]=> string(24) "someone@example.com" ["from":protected]=> string(24) "someone@example.com" ["sender":protected]=> string(12) "mystore" ["reply_to":protected]=> NULL ["subject":protected]=> string(17) "text_new_customer" ["text":protected]=> string(8) "TextHere" ["html":protected]=> NULL ["attachments":protected]=> array(0) { } ["parameter"]=> string(0) "" ["adaptor"]=> object(Mail\Smtp)#104 (16) { ["smtp_hostname"]=> string(21) "mail.mystore.com" ["smtp_username"]=> string(24) "someone@example.com" ["smtp_password"]=> string(12) "OVoO*[iOtE[T" ["smtp_port"]=> string(2) "25" ["smtp_timeout"]=> string(1) "5" ["verp"]=> bool(false) ["to"]=> string(24) "someone@example.com" ["from"]=> string(24) "someone@example.com" ["sender"]=> string(12) "mystore" ["reply_to"]=> NULL ["subject"]=> string(17) "text_new_customer" ["text"]=> string(8) "TextHere" ["html"]=> NULL ["attachments"]=> array(0) { } ["parameter"]=> string(0) "" ["adaptor"]=> *RECURSION* } ["smtp_hostname"]=> string(21) "mail.mystore.com" ["smtp_username"]=> string(24) "someone@example.com" ["smtp_password"]=> string(12) "OVoO*[iOtE[T" ["smtp_port"]=> string(2) "25" ["smtp_timeout"]=> string(1) "5" }