Skip to content

Commit 1993881

Browse files
Merge branch 'version_406'
2 parents e7a76c7 + fc44f25 commit 1993881

5 files changed

Lines changed: 385 additions & 361 deletions

File tree

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ Send text or html email with attachments and shortcodes from WP Dashboard or com
44

55
* Requires: [WordPress 4.6](https://wordpress.org/support/wordpress-version/version-4-6/)
66
* Tested with: [WordPress 5.6](https://wordpress.org/support/wordpress-version/version-5-6/)
7-
* Stable version: [4.0.5](https://github.com/mitchelldmiller/quick-mail-wp-plugin/releases/latest)
7+
* Stable version: [4.0.6](https://github.com/mitchelldmiller/quick-mail-wp-plugin/releases/latest)
88

99
Description
1010
-----------

inc/class-quickmailutil.php

Lines changed: 23 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -172,36 +172,32 @@ public static function filter_user_emails( $original ) {
172172
* @since 4.0.5
173173
*/
174174
public static function acceptable_domain( $domain ) {
175-
$url = "{$_SERVER['REQUEST_SCHEME']}://{$_SERVER['SERVER_NAME']}/wp-admin/admin-ajax.php";
176-
$hash = password_hash( $domain, PASSWORD_DEFAULT );
177-
$args = array(
175+
$url = "{$_SERVER['REQUEST_SCHEME']}://{$_SERVER['SERVER_NAME']}/wp-admin/admin-ajax.php";
176+
$hash = password_hash( $domain, PASSWORD_DEFAULT );
177+
$args = array(
178178
'action' => 'quick_mail_banned',
179179
'security' => $hash,
180180
'domain' => $domain,
181181
);
182-
$content = http_build_query( $args );
183-
$protocol = floatval( substr( $_SERVER['SERVER_PROTOCOL'], -3 ) );
184-
$h1 = "Content-type: application/x-www-form-urlencoded\r\n";
185-
$dlen = strlen( $content );
186-
$h2 = "Content-Length: {$dlen}\r\n";
187-
$header = $h1 . $h2;
188-
$options = array(
189-
'http' =>
190-
array(
191-
'method' => 'POST',
192-
'header' => $header,
193-
'user_agent' => 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:84.0) Gecko/20100101 Firefox/84.0',
194-
'protocol' => $protocol,
195-
'content' => $content,
196-
),
197-
);
198-
199-
$stream_context = stream_context_create( $options );
200-
$result = file_get_contents( $url, false, $stream_context );
201-
if ( false !== $result ) {
202-
$domain = $result;
203-
}
204-
return $domain;
182+
$content = http_build_query( $args );
183+
$moz = 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:84.0) Gecko/20100101 Firefox/84.0';
184+
$result = '';
185+
try {
186+
$ch = curl_init();
187+
curl_setopt( $ch, CURLOPT_URL, $url );
188+
curl_setopt( $ch, CURLOPT_POST, true );
189+
curl_setopt( $ch, CURLOPT_POSTFIELDS, $content );
190+
curl_setopt( $ch, CURLOPT_RETURNTRANSFER, true );
191+
curl_setopt( $ch, CURLOPT_USERAGENT, $moz );
192+
$result = curl_exec( $ch );
193+
$code = curl_getinfo( $ch, CURLINFO_RESPONSE_CODE );
194+
curl_close( $ch );
195+
if ( 200 !== $code || ! is_string( $result ) ) {
196+
$result = $domain;
197+
} // Allow until user submits form.
198+
} catch ( \Exception $e ) {
199+
$result = $domain; }
200+
return $result;
205201
}
206202

207203
/**
@@ -246,7 +242,7 @@ public static function qm_valid_email_domain( $qm_address, $validate_option = 'N
246242
247243
if ( function_exists( 'idn_to_ascii' ) ) {
248244
$intl = defined( 'INTL_IDNA_VARIANT_UTS46' ) && defined( 'IDNA_NONTRANSITIONAL_TO_ASCII' ) ? idn_to_ascii( $a_split[1], IDNA_NONTRANSITIONAL_TO_ASCII, INTL_IDNA_VARIANT_UTS46 ) : idn_to_ascii( $a_split[1] );
249-
if ( ! empty( $intl ) ) {
245+
if ( ! empty( $intl ) && 4 < strlen( $intl ) && 'xn--' === substr( $intl, 0, 4 ) ) {
250246
$a_split[1] = $intl;
251247
} // end if we have punycode address. xn--mrens-bsa.club = mérens.club.
252248
} // end if we have idn_to_ascii

0 commit comments

Comments
 (0)