I want to know if it's possible to change the $from variable to receive the mails from the contact form directly from the customer mail and not from our website mail, because it's a nuissance to have in our e-mail all the emails coming from the same email address due to how they appear (in vertical alignment, one below another), and it's horrible to manage what mails have been responded or not.
I'm trying to do this, and I think the "magic" could be done somewhere between this lines inside the "ContactController.php"
if (empty($contact->email)) {
Mail::Send($this->context->language->id, 'contact_form', ((isset($ct) && Validate::isLoadedObject($ct)) ? sprintf(Mail::l('Your message has been correctly sent #ct%1$s #tc%2$s'), $ct->id, $ct->token) : Mail::l('Your message has been correctly sent')), $var_list, $from, null, null, null, $file_attachment);
} else {
if (!Mail::Send($this->context->language->id, 'contact', Mail::l('Message from contact form').' [no_sync]',
$var_list, $contact->email, $contact->name, null, null,
$file_attachment, null, _PS_MAIL_DIR_, false, null, null, $from) ||
!Mail::Send($this->context->language->id, 'contact_form', ((isset($ct) && Validate::isLoadedObject($ct)) ? sprintf(Mail::l('Your message has been correctly sent #ct%1$s #tc%2$s'), $ct->id, $ct->token) : Mail::l('Your message has been correctly sent')), $var_list, $from, null, null, null, $file_attachment, null, _PS_MAIL_DIR_, false, null, null, $contact->email)) {
$this->errors[] = Tools::displayError('An error occurred while sending the message.');
}
}
I tried to change the $contact->email for the $from variable(because it appears to have stored the customer email from the form), but this way the mails are not sending, although the succes message is appering.
Thanks to someone who can help.
Greetings,
Agustin.