Tagged: 

Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • #210214

    I capture
    ‘Element: E-Mail’
    With the built in contact form
    Unfortunately this method sends the message on to ‘Your email address’ using ‘Element: E-Mail’ as sender
    Can sender be changed to fixed address and element simply included in body?

    Reason: Hard code sender to bypass spam filter

    #210403

    Hi!

    You can hard code that in framework/php/class-form-generator.php, line 664 and line 669:

    $header .= 'From: '. $from . " <".$from."> \r\n";
    

    Best regards,
    Josue

    #210419

    OK so looking at those, and not really understanding what I am looking at:

    foreach($copy as $send_to_mail)
    			{
    				if($use_wpmail)
    				{
    					$header .= 'From: '. $from . " <".$from."> \r\n";
    					wp_mail($send_to_mail, $subject, $message, $header);
    				}
    				else
    				{
    					$header .= 'From:'. $from . " \r\n";
    					mail($send_to_mail, $subject, $message, $header);
    				}
    			}

    is my change something like:

    foreach($copy as $send_to_mail)
    			{
    				if($use_wpmail)
    				{
    					$header .= 'From: '.  (Email address hidden if logged out)  . " <".$from."> \r\n";
    					wp_mail($send_to_mail, $from, $subject, $message, $header);
    				}
    				else
    				{
    					$header .= 'From:'.  (Email address hidden if logged out)  . " \r\n";
    					mail($send_to_mail, $from, $subject, $message, $header);
    				}
    			}
    • This reply was modified 10 years, 10 months ago by aribann.
    #210424

    Hi!

    This would be the code:

    foreach($copy as $send_to_mail)
    {
    	if($use_wpmail)
    	{
    		$header .= 'From:  (Email address hidden if logged out)  < (Email address hidden if logged out) > \r\n';
    		wp_mail($send_to_mail, $from, $subject, $message, $header);
    	}
    	else
    	{
    		$header .= 'From:  (Email address hidden if logged out)  \r\n';
    		mail($send_to_mail, $from, $subject, $message, $header);
    	}
    }
    

    Regards,
    Josue

    #210426

    Brilliant
    Many thanks

    #210433

    You are welcome, glad we could help :)

    Regards,
    Josue

    #210434

    Oddly
    Subject is received as what the user enters as their email address
    and
    From WordPress < (Email address hidden if logged out) >
    and
    the body of the message is what the contact form has hard coded as the subject

    so its close

    #210465

    Ok learned this

    By default, the WordPress mailer fills in the From: field with (Email address hidden if logged out) and the From: name as WordPress.

Viewing 8 posts - 1 through 8 (of 8 total)
  • The topic ‘Contact Form – Change Sender to Fixed Value and Retain captured Element’ is closed to new replies.