Answers.Body: <p>A <code>NULL</code> value won't be a valid email address, so you'll struggle to get this into CiviCRM. This is intentional - why store an email that's not valid?</p>
  
  <h2>Remove address by contact edit</h2>
  
  <p>Correct procedure is to remove the address you want to get rid of. When editing a contact, you should be able to click on the email section, delete the text in the email field, and hit save.</p>
  
  <p>Does that solve your problem? Your question doesn't indicate why you'd want to store a <code>NULL</code> instead of just deleting the relevant email entry.</p>
  
  <p><a href="https://i.sstatic.net/lgIqJ.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/lgIqJ.png" alt="editing email address"></a></p>
  
  <h2>Remove addresses by SQL</h2>
  
  <p>Since you say you have a bunch of "bad" addresses, you can remove them via SQL. Accessing the underlying data in CiviCRM may have risks (eg other data might be associated with an address you delete), so this should be done with caution. Here's the SQL command to delete emails <code>none@none.com</code></p>
  
  <pre><code>DELETE FROM civicrm_email WHERE email='none@none.com';
  </code></pre>
  
  <p>(If anyone can suggest issues to this approach, please do so in comments?)</p>
  
  <h2>Remove addresses via API</h2>
  
  <p>You can also use the API - slightly more complex, but you're updating CiviCRM via its proper interfaces and it will be better able to handle the business logic around removing related data.</p>
  
  <p>There's an API explorer in CiviCRM at <code>civicrm/api/explorer</code>, and using the tools there you can compose API commands to do what you want. Example code is given in the API explorer for javascript, PHP etc. For example, to find then remove addresses <code>none@none.com</code> using javascript (works from browser console if logged in with appropriate rights).</p>
  
  <pre><code>CRM.api3('Email', 'get', {
    "sequential": 1,
    "email": "none@none.com",
    "options": {"limit":0}
  }).done(function(result) {
    result.values.forEach(function(email) {
      CRM.api3('Email', 'delete', { "id": email.id });
    });
  });
  </code></pre>
  
  <p>You could use the sample PHP provided there instead, via a custom extension or module.</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-02-08T01:34:53.423Z
Answers.Text: Ah, maybe you're trying to "import" a batch of email addresses that you want removed? That's an interesting use case - if that's your situation, maybe clarify that as the reason for this and someone might have a clue how else you could achieve what you need to?
Answers.UserDisplayName: Chris Burgess
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-02-08T15:32:54.400Z
Answers.Text: Thanks, Chris, for the insight!
  
  Yes, we are wanting to import a batch of email addresses that we want removed. 
  
  Probably a long time ago, someone thought they were cleaning our database and put "none@none.com" in any email address that was blank. This is causing one huge mess with deduping/merging as all of these people have the same email address.
  
  I'm basically wanting to run a report of anyone with this email address and mass-delete them. I could manually delete out the email as you described in the screenshot, but that's a lot of manual work... I was hoping to mass upload it.
Answers.UserDisplayName: Peter Dodge
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-02-09T18:21:24.557Z
Answers.Text: Aha ... so yes, overwriting with bad data to obliterate old data is the wrong approach, but you already knew that! Flagging addresses "do not contact"/"bounces" etc in CiviCRM would have given the org better data long term (eg org can't prevent re-addition of do-not-contact addresses if it no longer knows which addresses to not contact). Answer updated with some methods to clean up.
Answers.UserDisplayName: Chris Burgess
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-02-09T18:37:38.817Z
Answers.Text: Fun fact: `none@none.com` is a valid email address on a registered domain, so the approach of overwriting with a made-up email could have led to spamming a valid email account, affecting your mail reputation OR even leaking your org's contact data / logins to another site. There are legit domains that can be used for "fake" emails: [RFC2606](https://tools.ietf.org/html/rfc2606)'s `example.org`, `example.com`, `example.net` and friends, but these are a small list of specifically reserved domains.
Answers.UserDisplayName: Chris Burgess
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-10-17T00:44:43.077Z
Answers.Text: We have a scenario where we want to remove an email while doing an import - eg we are needing to enter an email for Location Type x and remove one for Location Type y. Importing NULL would be great. There are tickets about being able to do this for Address fields. Wondering if it seems rational to tweak the 'validate emails' so that it allows NULL to be imported?
Answers.UserDisplayName: petednz - fuzion
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-02-08T01:33:08.453Z
Answers.LastActivityDate: 2017-02-09T18:33:45.357Z
Answers.LastEditDate: 2017-02-09T18:33:45.357Z
Answers.UserDisplayName: Chris Burgess
Answers.Body: <p>Elaborating on Chris's great answer (and based on your clarification of what you're looking for): you can delete all instances of a particular email address directly from the API explorer with chaining; no need to use Javascript or PHP. Navigate to <code>civicrm/api/explorer</code> and enter the following values:
  <a href="https://i.sstatic.net/i6ytG.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/i6ytG.png" alt="enter image description here"></a></p>
  
  <p>Then hit "Execute".</p>
  
  <p>As with any operation that may affect a large number of records, it wouldn't be a bad idea to make a backup of your database first, no matter which one of these methods you use.</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-02-18T17:15:43.777Z
Answers.Text: This is brilliant.
Answers.UserDisplayName: Jon G - Megaphone Tech
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-02-18T07:21:26.247Z
Answers.LastActivityDate: 2017-02-18T17:31:13.740Z
Answers.LastEditDate: 2017-02-18T17:31:13.740Z
Answers.UserDisplayName: Noah Miller
Body: <p>Is there a way to overwrite a Contact's email address with a null value?</p>
  
  <p>I tried uploading contact info (via: Import Contacts) with a blank email field, but this doesn't override an existing email address.</p>
  
  <p>Thanks!</p>
  
Tags: <contacts>
Title: Uploading null email address
ThreadText: # Uploading null email address
  
  (Asked by: username_0 on 2017-02-07)
  
  Is there a way to overwrite a Contact's email address with a null value?
  
  I tried uploading contact info (via: Import Contacts) with a blank email field, but this doesn't override an existing email address.
  
  Thanks!
  
  **Tags:** contacts
  
  
  ---
  
  ## 2 answers
  
  ### Answer by username_1 on 2017-02-08. Score: 2
  
  A `NULL` value won't be a valid email address, so you'll struggle to get this into CiviCRM. This is intentional - why store an email that's not valid?
  
  ## Remove address by contact edit
  
  Correct procedure is to remove the address you want to get rid of. When editing a contact, you should be able to click on the email section, delete the text in the email field, and hit save.
  
  Does that solve your problem? Your question doesn't indicate why you'd want to store a `NULL` instead of just deleting the relevant email entry.
  
  [![editing email address](https://i.sstatic.net/lgIqJ.png)](https://i.sstatic.net/lgIqJ.png)
  
  ## Remove addresses by SQL
  
  Since you say you have a bunch of "bad" addresses, you can remove them via SQL. Accessing the underlying data in CiviCRM may have risks (eg other data might be associated with an address you delete), so this should be done with caution. Here's the SQL command to delete emails `none@none.com`
  
  ```
  DELETE FROM civicrm_email WHERE email='none@none.com';
  
  ```
  
  (If anyone can suggest issues to this approach, please do so in comments?)
  
  ## Remove addresses via API
  
  You can also use the API - slightly more complex, but you're updating CiviCRM via its proper interfaces and it will be better able to handle the business logic around removing related data.
  
  There's an API explorer in CiviCRM at `civicrm/api/explorer`, and using the tools there you can compose API commands to do what you want. Example code is given in the API explorer for javascript, PHP etc. For example, to find then remove addresses `none@none.com` using javascript (works from browser console if logged in with appropriate rights).
  
  ```
  CRM.api3('Email', 'get', {
    "sequential": 1,
    "email": "none@none.com",
    "options": {"limit":0}
  }).done(function(result) {
    result.values.forEach(function(email) {
      CRM.api3('Email', 'delete', { "id": email.id });
    });
  });
  
  ```
  
  You could use the sample PHP provided there instead, via a custom extension or module.
  
  > **Comments:**
  > **username_1**: Ah, maybe you're trying to "import" a batch of email addresses that you want removed? That's an interesting use case - if that's your situation, maybe clarify that as the reason for this and someone might have a clue how else you could achieve what you need to?  
  > **username_0**: Thanks, username_1, for the insight!  Yes, we are wanting to import a batch of email addresses that we want removed.   Probably a long time ago, someone thought they were cleaning our database and put "none@none.com" in any email address that was blank. This is causing one huge mess with deduping/merging as all of these people have the same email address.  I'm basically wanting to run a report of anyone with this email address and mass-delete them. I could manually delete out the email as you described in the screenshot, but that's a lot of manual work... I was hoping to mass upload it.  
  > **username_1**: Aha ... so yes, overwriting with bad data to obliterate old data is the wrong approach, but you already knew that! Flagging addresses "do not contact"/"bounces" etc in CiviCRM would have given the org better data long term (eg org can't prevent re-addition of do-not-contact addresses if it no longer knows which addresses to not contact). Answer updated with some methods to clean up.  
  > **username_1**: Fun fact: `none@none.com` is a valid email address on a registered domain, so the approach of overwriting with a made-up email could have led to spamming a valid email account, affecting your mail reputation OR even leaking your org's contact data / logins to another site. There are legit domains that can be used for "fake" emails: [RFC2606](https://tools.ietf.org/html/rfc2606)'s `example.org`, `example.com`, `example.net` and friends, but these are a small list of specifically reserved domains.  
  > **username_2**: We have a scenario where we want to remove an email while doing an import - eg we are needing to enter an email for Location Type x and remove one for Location Type y. Importing NULL would be great. There are tickets about being able to do this for Address fields. Wondering if it seems rational to tweak the 'validate emails' so that it allows NULL to be imported?  
  
  ---
  
  ### Answer by username_3 on 2017-02-18. Score: 2
  
  Elaborating on username_1's great answer (and based on your clarification of what you're looking for): you can delete all instances of a particular email address directly from the API explorer with chaining; no need to use Javascript or PHP. Navigate to `civicrm/api/explorer` and enter the following values:
  [![enter image description here](https://i.sstatic.net/i6ytG.png)](https://i.sstatic.net/i6ytG.png)
  
  Then hit "Execute".
  
  As with any operation that may affect a large number of records, it wouldn't be a bad idea to make a backup of your database first, no matter which one of these methods you use.
  
  > **Comments:**
  > **username_4**: This is brilliant.  
  
  ---
  
  