• I am using Contact Form 7 (3.1.2) with the Configure SMTP (3.1) plugin, because the host of my website has several emailservers that are blacklisted. Thanks to the SMTP-plugin I receive a bouncemail when an email from the form is rejected.
    However, since I use this plugin, the sending email address has changed as well. I have indicated that the form should send emails from “[your-name] <[your-email]>”.
    ‘<your-name>’ is taken correctly from the information in the form, but the ‘<your-email>’ is being replaced by my own email address. Since I am not the one who’s responsible for handling the incoming emails, this is causing a lot of confusion because people seem not to get that if they just push ‘reply’ they send an email to me instead of to the person that used the form. So, I end up receiving a lot of email that’s not meant for me and other people do not get their emails.

    Anyone who has any clue how to change this? How can I make the form use the proper <your-email> again?

    https://www.ads-software.com/extend/plugins/contact-form-7/

Viewing 11 replies - 1 through 11 (of 11 total)
  • Plugin Author Takayuki Miyoshi

    (@takayukister)

    but the ‘<your-email>’ is being replaced by my own email address.

    Normally this shouldn’t happen. Try deactivating all other plugins and switching to the default theme. One of them might be replacing it.

    Thread Starter tuindwerg

    (@tuindwerg)

    I’m using the Atahualpa theme and three other plugins: Hover, NextGenGallery and Slimbox Plugin. Deactivating hover & slimbox did not help. If I deactivate NextGen Gallery, I don’t loose all uploaded pictures (over 5,000 in more than 150 galleries), do I?
    I see that a lot of other people are using Atahualpa, cannot imagine that this will be the cause. But I’m willing to try to change to the default theme. Does that imply that if I change back to Atahualpa, I have lost all my settings?

    Have you been able to resolve this?

    My <your email> in the “from” field is also being set to my SMTP email and not the supplied email information. However, it is resolving correctly in the body of the form.

    Thread Starter tuindwerg

    (@tuindwerg)

    Nope, it’s still not working for me. What do you mean by “However, it is resolving correctly in the body of the form.”, did you resolve the problem in the body of the form?

    Thread Starter tuindwerg

    (@tuindwerg)

    Problem is still not resolved, an upgrade to wordpress 3.4.1 didn’t help either. Anyone with some suggestions?

    dleung

    (@dleung)

    did anyone ever fix this problem? I have this issue. One way I can think of fixing this is to try and add some filters in the actual Contact Form 7 plugin code to manually set the From address. Has anyone tried this or have any other solution?

    Thread Starter tuindwerg

    (@tuindwerg)

    For me, it still isn’t fixed. I still have the same problem.

    dleung

    (@dleung)

    NOTE: This is not a fix, but something I’ve been toying with, it may or may not work. Any suggestions or help would be appreciated.

    I’ve been playing around with a small hack into the code, I have to test still, and it has drawbacks but for what I have to do it might work.

    For my site, we are using CM7 for Contact Us, and need the “From” to be 100% the email the user puts in so our helpdesk can sort it properly.

    So what I did

    was in

    contact-form-7->includes->classes.php

    on approx line 400, you need to make the sender var global.

    global $sender;
    $sender = preg_replace_callback( $regex, $callback, $mail_template['sender'] );

    Then on around line 427
    add in 2 filters

    extract( $components );
    
                     //overide filter for "From" address
                    add_filter('wp_mail_from','cr_set_mail_from');
    		function cr_set_mail_from(){
                        global $sender;
                        return $sender;
    		}
    		add_filter('wp_mail_from_name','cr_set_mail_name');
    		function cr_set_mail_name(){
                        $blankness = '';
                        return $blankness;
                    }
    
    		$headers = "From: $sender\n";

    In order for this to work, on the CM7 options for the form “From” field, you have to use the email address only, you cannot include the name of the person or the <>, because the filter wp_mail_from only takes in an email. (so use [your-email] and not [your-name] <[your-email]>)
    so what the new filter does is override the “From” address with the email you set in the Form options, [your-email].

    I’ve only briefly tested it but will do more tomorrow, if you have a test server I highly suggest you test it out there first before doing anything.

    Im not sure but you might have to remove the filters after the mail is sent, but I’ve tried sending an email via another plugin and the filter does not seem to effect it (sending from the email set in configure smtp).

    Also note, if you use [your-name] <[your-email]> , you can use regular expressions to extract the [your-name] and [your-email] and then plug in the values to the functions the filters are calling, though there might be a lot to consider in creating that regular expression given the [your-name] field might have some weird things in it.

    Again this is just some toying with the plugin, I would appreciate any input or suggestions or even testing on your end.

    dleung

    (@dleung)

    Update, I switched from Config SMTP to Cimy Swift SMTP https://www.ads-software.com/extend/plugins/cimy-swift-smtp/

    and theres an option in the settings
    “Never overwrite the sender:”

    make sure this is checkmarked.

    Once thats done everything worked.

    So the problem was with configure SMTP, don’t use that.

    Thread Starter tuindwerg

    (@tuindwerg)

    Thanks for trying to fix it and for keeping us posted. I tried using Cimy Swift, but for me it didn’t help: I still have the same problem, even with ‘never overwrite sender’ checkmarked. I didn’t dare to try your previous solution, sorry! I don’t have a good test environment and I’m afraid to mess things up.

    dleung

    (@dleung)

    sorry to hear its not working, what email are you getting still? Is it the [email protected] email? If so try the 3rd option in cimy “Overwrite the sender only for the WordPress default “. I had to do this on our login site so the emails sent from the password reset wasnt from [email protected]. Try that out. Im also assuming you disabled configure smtp?

Viewing 11 replies - 1 through 11 (of 11 total)
  • The topic ‘"Sent from" in Contact Form 7 Configure SMTP’ is closed to new replies.