Code Duplication    Length = 10-31 lines in 2 locations

includes/specials/SpecialEmailuser.php 2 locations

@@ 348-378 (lines=31) @@
345
			return $error;
346
		}
347
348
		if ( $config->get( 'UserEmailUseReplyTo' ) ) {
349
			/**
350
			 * Put the generic wiki autogenerated address in the From:
351
			 * header and reserve the user for Reply-To.
352
			 *
353
			 * This is a bit ugly, but will serve to differentiate
354
			 * wiki-borne mails from direct mails and protects against
355
			 * SPF and bounce problems with some mailers (see below).
356
			 */
357
			$mailFrom = new MailAddress( $config->get( 'PasswordSender' ),
358
				wfMessage( 'emailsender' )->inContentLanguage()->text() );
359
			$replyTo = $from;
360
		} else {
361
			/**
362
			 * Put the sending user's e-mail address in the From: header.
363
			 *
364
			 * This is clean-looking and convenient, but has issues.
365
			 * One is that it doesn't as clearly differentiate the wiki mail
366
			 * from "directly" sent mails.
367
			 *
368
			 * Another is that some mailers (like sSMTP) will use the From
369
			 * address as the envelope sender as well. For open sites this
370
			 * can cause mails to be flunked for SPF violations (since the
371
			 * wiki server isn't an authorized sender for various users'
372
			 * domains) as well as creating a privacy issue as bounces
373
			 * containing the recipient's e-mail address may get sent to
374
			 * the sending user.
375
			 */
376
			$mailFrom = $from;
377
			$replyTo = null;
378
		}
379
380
		$status = UserMailer::send( $to, $mailFrom, $subject, $text, [
381
			'replyTo' => $replyTo,
@@ 399-408 (lines=10) @@
396
397
				Hooks::run( 'EmailUserCC', [ &$ccTo, &$ccFrom, &$ccSubject, &$ccText ] );
398
399
				if ( $config->get( 'UserEmailUseReplyTo' ) ) {
400
					$mailFrom = new MailAddress(
401
						$config->get( 'PasswordSender' ),
402
						wfMessage( 'emailsender' )->inContentLanguage()->text()
403
					);
404
					$replyTo = $ccFrom;
405
				} else {
406
					$mailFrom = $ccFrom;
407
					$replyTo = null;
408
				}
409
410
				$ccStatus = UserMailer::send(
411
					$ccTo, $mailFrom, $ccSubject, $ccText, [