Adds a new email address, ignoring "type" and "primary" fields, which we
don't need yet
546817
public void addEmail(String newEmail) {
        Assert.hasText(newEmail, "Attempted to add null or empty email string to user.");

        if (emails == null) {
            emails = new ArrayList<>(1);
        }
        for (Email email : emails) {
            if (email.value.equals(newEmail)) {
                throw new IllegalArgumentException("Already contains email " + newEmail);
            }
        }

        Email e = new Email();
        e.setValue(newEmail);
        emails.add(e);
    }
1282244
function(template, options){
			var payload = { data: {}, template_id: template };

			// Add root attributes to the payload root
			for(var attr in rootAttributes){
				if(!rootAttributes.hasOwnProperty(attr)){
					continue;
				}
				if(typeof options[attr] === 'undefined'){
					continue;
				}
				var key = rootAttributes[attr],
					val = options[attr];
				payload[key] = val;
				delete options[attr];
			}

			// Add any left over attribtues to the data object
			for(attr in options){
				if(!options.hasOwnProperty(attr)){
					continue;
				}
				payload.data[attr] = options[attr]
			}

			// Add to the list of emails
			this.mails.push(payload);
		}
1143606
function(apiKey, contactId, fromName,
        fromAddress, toAddress, ccAddresses, bccAddresses, contentType,
        subject, htmlBody, textBody, header, receivedDate, sentDate,
        emailSentType) {}
809210
def clean_email(self):
        
        email = self.cleaned_data.get("email")
        qs = User.objects.exclude(id=self.instance.id).filter(email=email)
        if len(qs) == 0:
            return email
        raise forms.ValidationError(
                                ugettext("This email is already registered"))
1116293
private Email parseEmail(Node el){
        return new Email(
                nodeAttribute(el, TAG_VAR_ATTR_NAME, Email.DEFAULT_NAME),
                nodeAttribute(el, TAG_ATTR_GHOST, PatternElement.DEFAULT_GHOST_VALUE)
        );
    }
617646
def _change_generic(env, model_name, record_ids, target_record_id,
                    exclude_columns, method='orm'):
    
    for model_to_replace, res_id_column, model_column in [
            ('calendar.event', 'res_id', 'res_model'),
            ('ir.attachment', 'res_id', 'res_model'),
            ('mail.activity', 'res_id', 'res_model'),
            ('mail.followers', 'res_id', 'res_model'),
            ('mail.message', 'res_id', 'model'),
            ('rating.rating', 'res_id', 'res_model'),
            ]:
        try:
            model = env[model_to_replace].with_context(active_test=False)
        except KeyError:
            continue
        if (model._table, res_id_column) in exclude_columns:
            continue
        if method == 'orm':
            records = model.search([
                (model_column, '=', model_name),
                (res_id_column, 'in', record_ids)])
            if records:
                records.write({res_id_column: target_record_id})
                logger.debug(
                    "Changed %s record(s) of model '%s'",
                    len(records), model_to_replace)
        else:
            logged_query(
                env.cr,
                """ UPDATE %(table)s
                    SET %(res_id_column)s = %(target_record_id)s
                    WHERE %(model_column)s = %(model_name)s
                    AND %(res_id_column)s in %(record_ids)s
                """,
                {
                    'table': AsIs(model._table),
                    'res_id_column': AsIs(res_id_column),
                    'model_column': AsIs(model_column),
                    'model_name': model_name,
                    'target_record_id': target_record_id,
                    'record_ids': record_ids,
                }, skip_no_result=True)
323594
def email_type(arg):
	""""""
	if not is_valid_email_address(arg):
		raise argparse.ArgumentTypeError("{0} is not a valid email address".format(repr(arg)))
	return arg
893036
private function AddNextUrlField()
    {
        $name = 'NextUrl';
        $this->selectorNext = new PageUrlSelector($name, Trans($this->Label($name)), $this->changeMail->GetNextUrl());
        $this->selectorNext->SetRequired($this->ErrorPrefix($name));
        $this->Elements()->AddElement($name, $this->selectorNext);
    }
5628
public function add() {
		$this->err('Queue Email Task cannot be added via Console.');
		$this->out('Please use createJob() on the QueuedTask Model to create a Proper Email Task.');
		$this->out('The Data Array should look something like this:');
		$this->out(var_export([
			'settings' => [
				'to' => 'email@example.com',
				'subject' => 'Email Subject',
				'from' => 'system@example.com',
				'template' => 'sometemplate',
			],
			'content' => 'hello world',
		], true));
		$this->out('Alternativly, you can pass the whole EmailLib to directly use it.');
	}
1335787
protected function _addIdField() {
        $params = array(
            'type' => 'numeric',
            'editable' => false,
            'visible' => false,
            //  next to being primary, an extra index key is also needed,
            //  to enable the flexibility to modify primary keys.
            'index' => true
        );

        $params['primary'] = !$this->_primaryKeyFieldIsPresent();

        $this['inputs'] = array('id' => $params) + $this['inputs'];
    }
776173
def update_email(strategy, details, user=None, *args, **kwargs):
    """"""
    if user:
        email = details.get('email')

        if email and user.email != email:
            user.email = email
            strategy.storage.user.changed(user)
501586
public function email(): void
    {
        $oInput     = Factory::service('Input');
        $oUserModel = Factory::model('User', 'nails/module-auth');
        $action     = $oInput->post('action');
        $sEmail     = trim($oInput->post('email'));
        $iId        = (int) $oInput->post('id') ?: null;

        switch ($action) {

            case 'add':
                $bIsPrimary  = (bool) $oInput->post('isPrimary');
                $bIsVerified = (bool) $oInput->post('isVerified');

                if ($oUserModel->emailAdd($sEmail, $iId, $bIsPrimary, $bIsVerified)) {
                    $sStatus  = 'success';
                    $sMessage = '"' . $sEmail . '" was added successfully. ';
                } else {
                    $sStatus  = 'error';
                    $sMessage = 'Failed to add email. ';
                    $sMessage .= $oUserModel->lastError();
                }
                break;

            case 'delete':
                if ($oUserModel->emailDelete($sEmail, $iId)) {
                    $sStatus  = 'success';
                    $sMessage = '"' . $sEmail . '" was deleted successfully. ';
                } else {
                    $sStatus  = 'error';
                    $sMessage = 'Failed to delete email "' . $sEmail . '". ';
                    $sMessage .= $oUserModel->lastError();
                }
                break;

            case 'makePrimary':
                if ($oUserModel->emailMakePrimary($sEmail, $iId)) {
                    $sStatus  = 'success';
                    $sMessage = '"' . $sEmail . '" was set as the primary email.';
                } else {
                    $sStatus  = 'error';
                    $sMessage = 'Failed to mark "' . $sEmail . '" as the primary address. ';
                    $sMessage .= $oUserModel->lastError();
                }
                break;

            case 'verify':
                //  Get the code for this email
                $aUserEmails = $oUserModel->getEmailsForUser($iId);
                $sCode       = '';

                foreach ($aUserEmails as $oUserEmail) {
                    if ($oUserEmail->email == $sEmail) {
                        $sCode = $oUserEmail->code;
                    }
                }

                if (!empty($sCode) && $oUserModel->emailVerify($iId, $sCode)) {
                    $sStatus  = 'success';
                    $sMessage = '"' . $sEmail . '" was verified successfully.';
                } elseif (empty($sCode)) {
                    $sStatus  = 'error';
                    $sMessage = 'Failed to mark "' . $sEmail . '" as verified. ';
                    $sMessage .= 'Could not determine email\'s security code.';
                } else {
                    $sStatus  = 'error';
                    $sMessage = 'Failed to mark "' . $sEmail . '" as verified. ';
                    $sMessage .= $oUserModel->lastError();
                }
                break;

            default:
                $sStatus  = 'error';
                $sMessage = 'Unknown action: "' . $action . '"';
                break;
        }

        $oSession = Factory::service('Session', 'nails/module-auth');
        $oSession->setFlashData($sStatus, $sMessage);
        redirect($oInput->post('return'));
    }
1320490
protected function _addAddress($email, $name, $type) {

        $type = '_'.$type;

        $allowed = array(
            '_sender',
            '_from',
            '_to',
            '_cc',
            '_bcc',
            '_reply_to'
        );

        if (in_array($type, $allowed)) {
            if ($name != '') {
                $this->{$type}[$email] = $name;
            } else {
                $this->{$type}[] = $email;
            }
        }
    }
1025166
public function addAddress($email, $name = '')
    {
        if (empty($email)) {
            throw new MailerException('email is required for addAddress!');
        }

        $this->_mailer->addAddress($email, $name);

        return $this;
    }
154780
def before_add_field(self, field):
        
        if self.extract_fields and field.name == '*':
            field.ignore = True
            fields = [model_field.column for model_field in self.model._meta.fields]
            self.add_fields(fields)
234542
private function updateDatafieldsByType($type, $email, $websiteId)
    {
        switch ($type) {
            case self::AUTOMATION_TYPE_NEW_ORDER:
            case self::AUTOMATION_TYPE_NEW_GUEST_ORDER:
            case self::ORDER_STATUS_AUTOMATION:
            case self::AUTOMATION_TYPE_CUSTOMER_FIRST_ORDER:
                $this->updateNewOrderDatafields($websiteId);
                break;
            case self::AUTOMATION_TYPE_ABANDONED_CART_PROGRAM_ENROLMENT:
                $this->updateAbandoned->updateAbandonedCartDatafields($email, $websiteId, $this->typeId, $this->storeName);
            default:
                $this->updateDefaultDatafields($email, $websiteId);
                break;
        }
    }
833356
private function addAddressDescription()
	{	
		if(empty($this->data['addressDescription'])){
			if( !empty($this->data['streetAddress']) && ( !empty($this->data['addressLocality']) || !empty($this->data['postalCode']))){
				$this->data['addressDescription'] = "{$this->data['streetAddress']} ,";
				if(!empty($this->data['postalCode'])) { $this->data['addressDescription'].= " {$this->data['postalCode']}";}
				if(!empty($this->data['addressLocality'])) { $this->data['addressDescription'].= " {$this->data['addressLocality']}"; }
				if(!empty($this->data['addressRegion'])) { $this->data['addressDescription'].= " ({$this->data['addressRegion']})"; }
			} 
		}
		if(!empty($this->data['addressDescription'])){
			$this->data['addressDescription'] = \BOTK\Filters::FILTER_SANITIZE_ADDRESS($this->data['addressDescription']);
		}
	}