Responsive WordPress Theme – Caliber

A theme with simple controls and limitless potential. Work fast and build an amazing website!   Find out more »

UpThemes – Beautiful WordPress Themes

Create a site your church, gallery, newspaper, blog, recipes, band and more!   See the themes »

Need a little help?  Find answers quickly by searching the forum.
Group Admins
  • jeffw
  • andy

Support for: Mingle – Multi-purpose WordPress Theme

Mingle (WordPress)

Public Group  |  active 6 months, 3 weeks ago ago
Viewing post 1 to 2 (2 total posts)

Hard code contact form FROM field?

  • lubiland

    said

    Hi guys,

    I have your theme on a site for some time now, and have not had any issues before, but a client have moved their emails to a secure server with some antispam features and are asking is it possible to “hardcode” the FROM field to avoid emails sent via contact form to be blocked as some of their customers are on the same server as the email address the form enquiries go to. Because its can sometimes be the same server.

    Looked on your forum, found the issue, updated the unique ID, but they are being difficult and trying to earn their keep I think (the people providing emails) This is what they asked after I updated and told them it will no longer show the same address in both from and to fields. I am hoping its possible to just put that email address they are asking to use into the email-functions.php somewhere?????

    QUOTE
    That would be ok for the majority of senders but if any of our many clients choose to put their email business addresses in that field the email screening software we use may still reject that small percentage of emails from them as your email system/website will not be authorised to send out on behalf of their email address (as our screening system will know it’s a foreign system).

    The best long-term fix for this as I mentioned in my earlier email would be to hard code the FROM address to an arbitrary non-specific email address such as hc_website_form@noreply.local which would guarantee no further anti-spoofing related issues from sent emails originating from that server.

    If you can make this change then this will guarantee no further anti-spoofing issues in the future.
    UNQUOTE

    Thanks guys, I can see that in the email-functions.php file its looking for multiple things, then double checking etc. Is it possible to set a default FROM as hc_website_form@noreply.local

    Thanks again!
    Lubi

  • jeffw

    said

    On line 138 of the ‘framework/utilities/email-functions.php’ file you’ll see where the email headers string is set…

    $headers = 'From: '.$name.' <'.$email.'>' . "\r\n\\";

    You could hardcode the FROM name and email address like this perhaps…

    $hardcoded_name = 'HC Website Form';
    $hardcoded_email = 'hc_website_form@noreply.local';
    $headers = 'From: '.$hardcoded_name.' <'.$hardcoded_email.'>' . "\r\n\\";

    The enquirer’s name and email address will be in the $name and $email variables and you’d need to add those to the $message string (right below the line where the email header is set) otherwise you will have absolutely no idea who the email is from. Something like this maybe…

    $message = $br.$name.$br.$email.$br.$br.$email_body;

    I’ve not tested any of this code, I’ll leave that to you. ;)

    Note that when you update the theme you’ll need to make these changes again to the updated theme file.

    You might also be able to resolve this issue by using a modern form plugin for the contact form instead of the theme’s [contact_form] shortcode. These days we recommend Ninja Forms; it’s free and it really rocks! → https://en-gb.wordpress.org/plugins/ninja-forms/

Viewing post 1 to 2 (2 total posts)