i have been stuggling with getting mails sent from the 'contact us' form for some time, it just does not work with the system > setting > mail set to Mail. This seems to be a common problem on this forum. Anyway I have got further by using SMTP but have come across a problem; I have setup with Mailjet to do my smtp forwarding. please see the ticket i raised with them and their reply:
from Me:
Just trying out your service for the first time. I believe I have everything set up correctly however:
I have a webform on my site (it uses opencart and a template so I don't have control over the coding). It is just a standard 'contact us' web page. If I pretend to be a customomer and fill in the webform (lets say I put in my email address as me@mailhost.com) the process seems to work.
But the email never arrives, or so I thought. When I look at the senderlist on the mailjet portal I see them there, awaiting approval. It is like the form sends the email as if it is from the customers address (I suppose that is understandable if I were to simply reply to them)
Clearly I don't want to be authorising every email address that sends from my web form. I imagine that it is actually a security issue as it grants that user the right to forward emails through mailjet !?
Am I missing something or is this a fundamental issue?
any help would be gratefully received.
Their reply:
Hello Ian
The contact form you are trying to use is badly written, it should never be trying to send as the end user, as that is considered forged emails. Contact forms usually do it like that so you can reply easily to whoever filled it out, however they should be sending the email using From: your website email, Reply-To: users email
Unfortunately a contact form like the one your using would not work with Mailjet for the reasons that you already described, it would open security issues to allow anyone to send using your api credentials.
Michael
their logic seems more than reasonable and possibly explains why I can't get it to work through my providers email system (it treats it as forged). Does anyone know how to change the default "From:" to my email address? either in the admin panel of modifying php. I am on V1.5.6 OC BTW.
Any other input to this solution would be gratefully received.
Thanks in advance
Ian
Open: catalog\controller\information\contact.php
Code: Select all
// line 19 -20
$mail->setTo($this->config->get('config_email'));
$mail->setFrom($this->request->post['email']);
// to
$mail->setTo($this->config->get('config_email'));
$mail->setFrom($this->config->get('config_email'));
// to: admin@example.com
// from: admin@example.com
Many thanks for this, I tried you code and it solved my probelm, email is flowing smoothly now.
Of course I have now lost the email address of the customer trying to contact me, both the to and from fields are now my own email address, there doesn't appear to be a replyto option. I have got around this problem by inserting the customers email address into the subject line. I changed line 22 to:
$mail->setSubject("Enquiry: " . $this->request->post['name'] . " " . $this->request->post['email']);
to achieve this. Its not ideal as I simply can't just reply to the email but its good enough for me.
Many thanks again
Ian
DL
This account is inactive. Look for us under the name 'EvolveWebHosting' and contact us under that username.
Thanks!
The issue stems from them being blacklisted by some email hosts and my genuine emails being classed as spam. This meant the service was not consistent with some customers getting emails normally, some having email directed to junk and some customers getting no delivery at all.
Of course this may not be the issue you have but it is worth cheking out. Particularly if your mail problem is intermitant this may not be an open cart issue.
Hope this helps
Ian
DL
This account is inactive. Look for us under the name 'EvolveWebHosting' and contact us under that username.
Thanks!
There seem to be three issues that I've seen causing people headaches:
1. The OpenCart contact form sends emails out with the customer's email set as the "From" field in the header, and that can equal SPAM
2. Excessive base64 encoding of some of the header values gives rise to programs like SpamAssassin flagging it as SPAM and also seems to cause delivery issues with certain hosts
3. There is an issue with "newline" causing emails to be completely blank in some webmail and email clients
We should be able to fix these issues quite easily, as follows:
1. Alter the code so that the OpenCart contact form sends emails "From" the store email and sets the customer as "Reply-To" instead
2. Remove the base64 encoding of the Subject, To, From (and the new "Reply-To") fields in the email header
3. Change the "newline" values to make the email compatible with a wider range of webmail and email clients.
So, I've attached a fix for these three issues as an XML file.
NOTES:
- You will need VQMOD installed
- NO files are replaced - if this doesn't work, the worst thing you'll have to do is delete the XML file
- the mod affects the following files (tested in OC 1.5.6 but will probably work for other recent versions too):
catalog/controller/information/contact.php
system/library/mail.php
so if you've tweaked either of these files yourself, you'll have to replace them with the originals (or untweak them - but it can be tricky to get them back to EXACTLY how they were originally)
One last thing... some people who use GMail (or similar) for all their email needs, including their store emails, wonder why they have difficulty when they use their GMail address as their store email in SYSTEM > SETTINGS > GENERAL > E-MAIL. It is because whatever email address you enter on this page will be the email address that your store is seen to be sending outgoing messages from (like order updates, etc.) and if you're using your own host's systems to send email, you're essentially trying to use a third party to send an email that looks like it's coming from GMail. If you insist on using a GMail or Yahoo (or anything similar) address for your store, the you should be using the same provider's SMTP servers to process your email - NOT your host's servers. Using your host's servers usually works best when you are using an email account to send from that your host was involved in setting up.
If you have any questions, please ask.
FILE REMOVED AS NO LONGER VALID - 11.04.2015
Any chance you've made any modifications to it since you posted this?
Either way, thank you for the very detailed post, helped shed plenty of light on the subject for me!
-Chase
Please find attached a version that should work with 1.5.6.4.
FILE REMOVED AS NO LONGER VALID - 11.04.2015
Thanks
M
Inviato dal mio Find 5 utilizzando Tapatalk
-----------------------------------------------------------------------
My last mods: Partita IVA e CF | Pro EU VAT Number | Sales Agents | Pricelist Pro
-----------------------------------------------------------------------
http://www.opencart.com/index.php?route ... n_id=25250
Also if anyone has issues after this is fixed check if your ip is blacklisted:
http://mxtoolbox.com/SuperTool.aspx?action=blacklist
Remember use your server's ip not you websites ip. That can be different if you have an ssl cert.
Henry Weismann
877.44.MY.WEB (877.446.9932)
We can help with your Opencart Site - Opencart Web Developer
I just tried your extension (on oc v 1.5.5.1) and it worked fine.hcamelion wrote:I had this same issue with a client and created this:
http://www.opencart.com/index.php?route ... n_id=25250
Also if anyone has issues after this is fixed check if your ip is blacklisted:
http://mxtoolbox.com/SuperTool.aspx?action=blacklist
Remember use your server's ip not you websites ip. That can be different if you have an ssl cert.
For anyone that tries it, the customers email doesn't appear in the email (From: section), but when I hit reply to it populates their email address just fine.
Also, make sure the xml file goes into the vqmod folder. I tried uploading the vqmod folder and for some reason the file was placed outside the folder at first.
Thank you for this.
Andqahar wrote:You can edit manually or through vQmod
Open: catalog\controller\information\contact.php
Code: Select all
// line 19 -20 $mail->setTo($this->config->get('config_email')); $mail->setFrom($this->request->post['email']); // to $mail->setTo($this->config->get('config_email')); $mail->setFrom($this->config->get('config_email')); // to: admin@example.com // from: admin@example.com
This combination worked for my contact us page (OC v 1.5.5.1)Hi qahar,
Many thanks for this, I tried you code and it solved my probelm, email is flowing smoothly now.
Of course I have now lost the email address of the customer trying to contact me, both the to and from fields are now my own email address, there doesn't appear to be a replyto option. I have got around this problem by inserting the customers email address into the subject line. I changed line 22 to:
to achieve this. Its not ideal as I simply can't just reply to the email but its good enough for me.Code: Select all
$mail->setSubject("Enquiry: " . $this->request->post['name'] . " " . $this->request->post['email']);
Many thanks again
Ian
Henry Weismann
877.44.MY.WEB (877.446.9932)
We can help with your Opencart Site - Opencart Web Developer
Please note that I ONLY use it with OpenCart 1.5.6.4 so cannot guarantee that it will work with any other version - well, I cannot guarantee it will work at all, but I know it does for me!
There are several tweaks I added that the original versions I wrote did not include, and the reason I took them down at the time was because I wasn't using those older versions any longer. I don't like putting something "out there" that I don't use!
I think most (maybe even all) of the advice and explanation I gave in my first post above still stands, although there are additional things I have tweaked:
Changes: - uses first AND last name on contact form if customer is logged in
- disables autocomplete on contact form captcha
- sets 'From' and 'Reply-To' headers to customer email address in contact form emails
- sets 'Sender' and 'Return-Path' headers to the SMTP username
- sets 'MAIL FROM' (the SMTP envelope) to the SMTP username
- allows use of any email address as the store email and any third-party SMTP service
- removes base64 encoding from headers (SpamAssassin flags excessive base64 as a problem)
- fixes blank emails
- prevents incorrect formatting of email addresses (including removing white space from
beginning and end of email address)
- fixes creation of duplicate accounts with similar email address (e.g. email@example.com
vs. Email@Example.com) by ignoring email address case
I should also add that this version tweaks some slightly unhappy mailing code in the following extensions (but will just skip them if they are not found so will do no harm leaving it in):
Best Checkout http://www.opencart.com/index.php?route ... n_id=20736
One Page Checkout (not sure if this is still available to buy through the OC extension shop) http://www.opencart-one-page-checkout.com/
I can't offer much support as I don't regularly visit this thread - I might check it once a year - but if you're not in a rush then feel free to say something and I'll reply at some point.
Feel free to modify it for different iterations of OpenCart.
Users browsing this forum: No registered users and 298 guests