// build mail
$email = new Email();
- $email->addRecipient(new Mailbox($recipient->email));
+ $email->addRecipient($recipient->getMailbox());
$email->setSubject($defaultLanguage->get('wcf.contact.mail.subject'));
$email->setBody(new MimePartFacade([
new RecipientAwareTextMimePart('text/html', 'email_contact', 'wcf', $messageData),
<?php
namespace wcf\data\contact\recipient;
use wcf\data\DatabaseObject;
+use wcf\system\email\Mailbox;
use wcf\system\WCF;
/**
* @inheritDoc
*/
public function __toString() {
- return WCF::getLanguage()->get($this->name);
+ return $this->getName();
}
/**
$this->data['isAdministrator'] = MAIL_ADMIN_ADDRESS;
}
}
+
+ /**
+ * Returns the localized name of this recipient.
+ *
+ * @since 5.3
+ */
+ public function getName(): string {
+ return WCF::getLanguage()->get($this->name);
+ }
+
+ /**
+ * Returns the localized email address of this recipient.
+ *
+ * @since 5.3
+ */
+ public function getEmail(): string {
+ return WCF::getLanguage()->get($this->email);
+ }
+
+ /**
+ * Returns a localized Mailbox for this recipient.
+ *
+ * @since 5.3
+ */
+ public function getMailbox(): Mailbox {
+ return new Mailbox(
+ $this->getEmail(),
+ $this->getName()
+ );
+ }
}