• Resolved Anonymous User

    (@anonymized-14169293)


    For this kind of sites is normal to have one domain per site. Email validation doesn’t recognize (subsites) mapped domains, so it always cause an error because the email (subsite) doesn’t belong to the main site domain.

    CF7 only validates with the main site domain.

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

Viewing 7 replies - 16 through 22 (of 22 total)
  • Thread Starter Anonymous User

    (@anonymized-14169293)

    @davinian I guess you’re using your main site domain to send mails even in subsites, instead use your mapped domain. That’s why you don’t have issues now.

    What I want, is to be able to send mails using my mapped domains in subsites. What I’m actually doing but CF7 is considering like an error.

    @QROkes yes I am using the main domain name as that is what shows in the Message-ID of the sent emails.

    I am not sure the Domain Mapping plugins can override the Message-ID — you may need to use another plugin to allow custom SMTP (outgoing server settings) and setup each site separately.

    But I suspect CF7 probably won’t know about this and still think the From email is not validating.

    Thread Starter Anonymous User

    (@anonymized-14169293)

    Actually, I’m using Amazon SES (SMTP) for all my server outgoing mails. Amazon has a process to validate domains before you can send mails on behalf of that domain name. So, if they could validate my domains, I don’t see a valid reason why CF7 can’t do it. I don’t expect that CF7 do a DNS validation or something like that, but if some site has a mapped domain attached to an specific WP subsite, should be enough to considere it as a valid domain. Thats why SPF exists.

    It’s not a bad practice use a mapped domain with your WP multisite. There is no reason to say this is an “Error”.

    Thread Starter Anonymous User

    (@anonymized-14169293)

    Hi @takayukister
    I appreciatte your work, this plugin works great.
    But, this issue is still present in the recent released 4.4.1, do you think this could be fixed in the near future? Or, there are some reasons I’m not seeing to keep this false “error” in domain mapping installations?

    Thanks a lot for the support.
    Regards.

    Plugin Author Takayuki Miyoshi

    (@takayukister)

    Ideally, the plugin should look up DNS records to check if email authentication methods are properly set up. I feel it’s too much at this time, but it’s in future plans. Use of a domain mapping plugin is rather not relevant to the essence of this issue. If you are convinced that it’s a false alarm, it’s ok to ignore.

    Thread Starter Anonymous User

    (@anonymized-14169293)

    Hi @takayukister

    I was debbuging this issue and I think I found an easy solution. I know this is not critical, but this could be the fix for full Domain Mapping compatibility.

    I just made some changes to this function:
    (/contact-form-7/includes/formatting.php)

    function wpcf7_is_email_in_site_domain( $email ) {
    	if ( wpcf7_is_localhost() ) {
    		return true;
    	}
    
    	$site_domain = strtolower( $_SERVER['SERVER_NAME'] );
    
    	if ( preg_match( '/^[0-9.]+$/', $site_domain ) ) { // 123.456.789.012
    		return true;
    	}
    
    	if ( wpcf7_is_email_in_domain( $email, $site_domain ) ) {
    		return true;
    	}
    
    	$site_url = home_url();
    	if ( is_multisite() && function_exists( 'domain_mapping_siteurl' ) ) {
    		$site_url = domain_mapping_siteurl( false );
    	}
    
    	if ( preg_match( '%^https?://([^/]+)%', $site_url, $matches ) ) {
    		$site_domain = strtolower( $matches[1] );
    
    		if ( $site_domain != strtolower( $_SERVER['SERVER_NAME'] )
    		&& wpcf7_is_email_in_domain( $email, $site_domain ) ) {
    			return true;
    		}
    	}
    
    	return false;
    }

    What do you think about this solution?
    Is it possible to be included as an enhacement in the next release?

    Regards.

    Plugin Author Takayuki Miyoshi

    (@takayukister)

    Thank you very much. It looks good. I’ll do some tests and if everything is ok, I’ll probably include it into the next release.

Viewing 7 replies - 16 through 22 (of 22 total)
  • The topic ‘Multisite with domain mapping validation’ is closed to new replies.