adds a recipient (To)

@param address a valid email address
@param personal the real world name of the sender (can be null)
@throws AddressException in case of an invalid email address
486525
public void addTo(String address, String personal) throws AddressException {
		if(to == null) {
			to = new ArrayList<>();
		}
		to.add( toInternetAddress(address, personal) );
	}
1321149
public String addAddressToTarget(String address)
    {
        if (address != null)
        {
            MessageDetailTarget messageDetailTarget = (MessageDetailTarget)this.getMainRecord();
            String site = messageDetailTarget.getProperty(TrxMessageHeader.DESTINATION_PARAM);
            site = this.getSiteFromAddress(address, site);
            if (!messageDetailTarget.setProperty(TrxMessageHeader.DESTINATION_PARAM, site))
                address = null; // This type doesn't take properties (never)
            messageDetailTarget.setProperty(TrxMessageHeader.DESTINATION_MESSAGE_PARAM, this.getPathFromAddress(address, site));
            String wsdlPath = messageDetailTarget.getProperty(TrxMessageHeader.WSDL_PATH);
            wsdlPath = this.getPathFromAddress(wsdlPath, site);
            if (wsdlPath != null)
                messageDetailTarget.setProperty(TrxMessageHeader.WSDL_PATH, wsdlPath);
        }
        return address;
    }
1046274
public function send(string $address, string $subject, ?string $message = null): bool
    {
        // try to get message from global if not passed direct
        if ($message === null) {
            $message = $this->message;
        }

        try {
            if ($message === null) {
                throw new \Exception('Message body is empty!');
            }

            // try to build message and send it
            $message = (new \Swift_Message($subject))
                ->setFrom($this->from)
                ->setTo($address)
                ->setBody($message, 'text/html');
            $this->swift->send($message);
            return true;
        } catch (\Exception $e) {
            if (App::$Debug) {
                App::$Debug->addException($e);
                App::$Debug->addMessage('Send mail failed! Info: ' . $e->getMessage(), 'error');
            }
            return false;
        }
    }
1031533
def personByEmailAddress(self, address):
        
        email = self.store.findUnique(EmailAddress,
                                      EmailAddress.address == address,
                                      default=None)
        if email is not None:
            return email.person
133410
public static void validateAddress(String address) throws ServiceException {
        if (address == null || address.isEmpty()) {
            throw new ServiceException(
                    ErrorCode.SERVICE_INSTANCE_ADDRESS_FORMAT_ERROR);
        }
    }
1086145
def add_email_addresses(self, addresses=[]):
        
        json = []
        if addresses:
            url = self._build_url('user', 'emails')
            json = self._json(self._post(url, data=addresses), 201)
        return json
1081825
public Email recipient(EmailAddress recipient, RecipientType type) {
		recipient(new Recipient(recipient, type));
		return this;
	}
947245
public void addCc(String address, String personal) throws AddressException {
		if(cc == null) {
			cc = new ArrayList<>();
		}
		cc.add( toInternetAddress(address, personal) );
	}
435698
def add(name, address)
      device = Device.new(name: name, address: address)
      self << device
      device
    end
652861
public function setFrom($address, $name = '', $auto = true)
    {
        $address = trim($address);
        $name = trim(preg_replace('/[\r\n]+/', '', $name)); //Strip breaks and trim
        if (!$this->validateAddress($address)) {
            $this->setError($this->lang('invalid_address') . ': ' . $address);
            $this->edebug($this->lang('invalid_address') . ': ' . $address);
            if ($this->exceptions) {
                throw new Mail\MailerException($this->lang('invalid_address') . ': ' . $address);
            }
            return false;
        }
        $this->From = $address;
        $this->FromName = $name;
        if ($auto) {
            if (empty($this->Sender)) {
                $this->Sender = $address;
            }
        }
        return true;
    }
1316975
private void sendEmail(Message m, SendRawEmailRequest req)
            throws SendFailedException, MessagingException {

        Address[] sent = null;
        Address[] unsent = null;
        Address[] invalid = null;

        try {
            appendUserAgent(req, USER_AGENT);
            SendRawEmailResult resp = this.emailService.sendRawEmail(req);
            lastMessageId = resp.getMessageId();
            sent = m.getAllRecipients();
            unsent = new Address[0];
            invalid = new Address[0];
            super.notifyTransportListeners(TransportEvent.MESSAGE_DELIVERED,
                    sent, unsent, invalid, m);
        } catch (Exception e) {
            sent = new Address[0];
            unsent = m.getAllRecipients();
            invalid = new Address[0];
            super.notifyTransportListeners(
                    TransportEvent.MESSAGE_NOT_DELIVERED, sent, unsent,
                    invalid, m);
            throw new SendFailedException("Unable to send email", e, sent,
                    unsent, invalid);
        }
    }
905713
private function createAddresses($addresses) {
        if (array_key_exists('email', $addresses)) {
            $this->mailer->addAddress($addresses['email'], $addresses['name']);
        } else {
            foreach ($addresses as $address) {
                $this->mailer->addAddress($address['email'], $address['name']);
            }
        }
    }
1322395
def sender(self, value):
        
        if isinstance(value, Recipient):
            if value._parent is None:
                value._parent = self
                value._field = 'from'
            self.__sender = value
        elif isinstance(value, str):
            self.__sender.address = value
            self.__sender.name = ''
        else:
            raise ValueError(
                'sender must be an address string or a Recipient object')
        self._track_changes.add('from')
253886
protected void doSetFrom(String from, String personal) {
        assertArgumentNotEmpty("from", from);
        assertArgumentNotEmpty("personal", personal); // only from required
        postcard.setFrom(createAddress(from, personal));
    }
353614
public void addCc(final Address internetAddress) throws MessagingException
	{
		super.addRecipient(javax.mail.Message.RecipientType.CC, internetAddress);
	}
992571
@Override
    public void sendEmail(String subject, String body) {
        if (ArrayUtils.isEmpty(this.recipientEmailAddresses)) {
            log.warn("No recipients configured - no one to notify: ignoring...");
            return;
        }

        SendEmailRequest email = new SendEmailRequest();
        try {
            Destination destination = new Destination();
            destination.setToAddresses(Arrays.asList(this.recipientEmailAddresses));
            email.setDestination(destination);
            email.setSource(System.getProperty("notification.sender", "no-sender-specified"));
            Message message = new Message(new Content(subject), new Body(new Content(body)));
            email.setMessage(message);
            client.sendEmail(email);
            log.info("email sent: {}", email);
        } catch (Exception e) {
            log.error("failed to send " + email + ": " + e.getMessage(), e);
        }

    }
1349707
def recipient_address_create(self, data, **kwargs):
        ""
        api_path = "/api/v2/recipient_addresses.json"
        return self.call(api_path, method="POST", data=data, **kwargs)