• KZeni

    (@kzeni)


    I had some emails incorrectly marked as spam when using Contact Form 7 with reCAPTCHA. I corrected the inbound message in Flamingo by marking it as not spam, but it would be incredibly helpful if Flamingo offered a link/button which allows the emails associated with that inbound message to be re-sent on-demand (since it was never since initially in my case due to it being incorrectly marked as spam).

    I assume it could have an option to “Re-send all mail”, “Re-send Mail 1”, “Re-send Mail 2” if both mail delivery options are used for a submission (“Re-send Mail” just being offered if only one was used). Otherwise, I could certainly see it just re-send all no matter what to keep the options simple (though the flexibility to not re-send email to someone that might’ve already gotten it is probably worthwhile to provide.)

    This was also experienced by (and mentioned by) @nikkofir in the CF7 support forum here: https://wordpress.org/support/topic/feature-request-allow-the-recaptcha-score-threshold-to-be-customized/#post-11462821 I went ahead and created this support topic since it was separate from the original topic & is more suitable for Flamingo rather than CF7.

Viewing 4 replies - 1 through 4 (of 4 total)
  • Bump – this feature is important! We are still struggling with feeding the false positive spam messages back into our contact system. Responses from the dev that say that Flamingo doesn’t handle the spam filters are not helpful, as Flamingo is the plugin where we have to deal with the filtered messages – not CF7.

    A workaround to re-send messages marked as ‘not spam’ to the admin emails, until the plugin can be updated – modify the includes\class-inbound-message.php file – replace the function unspam with the following:

    
    public function unspam() {
    	if ( ! $this->spam ) {
    		return;
    	}
    
    	$this->akismet_submit_ham();
    	$this->spam = false;
    	
    	// new code inserted here ----------------
    	$message = "This message was marked as 'Not Spam'";
    	
    	// build message from the $this object e.g.		
    	$message .= "<br /><strong>From:</strong> ".$this->from_name;
    	$message .= "<br /><strong>Email:</strong> ".$this->from_email;
    	$message .= "<br /><strong>Subject:</strong> ".$this->subject;
    	$message .= "<br /><strong>Message Body:</strong> ".$this->fields['your-message'];
    
    	// add the meta data to the message if you want
    	$skipfields = array('site_url','url','post_id','post_name','post_url','post_title','post_author','post_author_email','site_title','site_description');
    	foreach($this->meta as $k=>$v){
    		if(!in_array($k,$skipfields)){$message .="<strong>".$k.":</strong> ".$v."<br />";}
    	}
    
    	// where to send the 're-sent' message
    	$to = $this->meta['site_admin_email'];
    	
    	//alternatively, send to current user
    	//$current_user = wp_get_current_user();
    	//$to = $current_user->user_email;
    
    	// edit the subject of the re-sent message
    	$subject = 'General Subject Here '.$this->meta['serial_number'].' '.$this->subject.'"';
    	
    	// edit the headers
    	$headers = array('Reply-To: '.$this->from_name.' <'.$this->from_email.'>');
    	
    	// send the message
    	wp_mail($to,$subject,$message,$headers);
    	
    	// end new code --------------------------------------
    	
    	return $this->save();
    }
    

    Could be improved to get the original mail recipients and mail template from CF7 but this is a fast a dirty way of getting the message re-sent.

    Thread Starter KZeni

    (@kzeni)

    @nikkofir It does make sense to have the email be sent when marking as not spam since the email notifications didn’t get sent the first time around. However, it would be more fitting if this code snippet actually pulled the email notification data for the corresponding form so the correct email recipient(s), subject, body message, etc. are all used (instead of hard-coding the body content, recipient[s], subject, etc. as your code has implemented [which is definitely fast & dirty, as you said.])

    This could then potentially have a checkbox to enable/disable re-sending of the email message when marking items as not spam. Then again, I might just opt to have this presented as buttons (and potentially in the bulk actions dropdown) to trigger these to be sent on-demand as I proposed in my first message above as the ideal way to provide this.

    @kzeni yes, would be much better to get the original mail recipients and mail template via the CF7 plugin. I went for fast and dirty, rather than messing around for ages trying to get Flamingo to talk to CF7 – probably not that hard but had to get a quick solution up for a client today…
    Hopefully the plugin dev has a more elegant solution lined up for us, or I may revisit this if I have to do it on other sites.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Feature Request: Add option to re-send emails’ is closed to new replies.