# Send Email to user only if their ID is not null

**URL:** <https://forum.inductiveautomation.com/t/send-email-to-user-only-if-their-id-is-not-null/44862>\
**Category:** Ignition\
**Tags:** perspective\
**Created:** [March 24, 2021, 3:59pm UTC](https://forum.inductiveautomation.com/t/send-email-to-user-only-if-their-id-is-not-null/44862 "2021-03-24T15:59:59Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![seanbuckley2698](https://avatars.discourse-cdn.com/v4/letter/s/d6d6ee/32.png) [@seanbuckley2698](https://forum.inductiveautomation.com/u/seanbuckley2698)\
**Post date:** [March 24, 2021, 3:59pm UTC](https://forum.inductiveautomation.com/t/send-email-to-user-only-if-their-id-is-not-null/44862/1 "2021-03-24T15:59:59Z")

</div>

I have the following code behind a button for deleting an object. The first email is sending, but the second email in the if statement is not. I dont want the email to be sent if the memberID is null. I am getting the memberID from a label in another view and I am passing it in as a parameter. I have tried putting the parameter in str() and without str() as well as using != or \<\> , as well as “” or “null”.

```auto
system.net.sendEmail(smtpProfile="SendInBlue", fromAddr="notification@ticketingsystemfyp.com", subject="Request Details Updated.", body="Hello, " + str(self.view.params.userFname) + ", your Request with the Request ID " + str(self.view.params.requestID) + " has been deleted. Your request was deleted on " + str(system.date.now()) + ". Request Nature: " + str(self.view.params.nature) + ". Request Description: " + str(self.view.params.requestDes) + ". Your request was deleted by " + str(self.session.props.auth.user.firstName) + ", their ID is " + str(self.session.props.auth.user.id) + ".", html=1, to= str(self.view.params.userEmail))

```

```
if self.view.params.memberID != "null":
	system.net.sendEmail(smtpProfile="SendInBlue", fromAddr="notification@ticketingsystemfyp.com", subject="Request Details Updated.", body="Hello, " + str(self.view.params.memberFname) + ", your Request with the Request ID " + str(self.view.params.requestID) + " has been deleted. Your request was updated on " + str(system.date.now()) + ". Request Nature: " + str(self.view.params.nature) + ". Request Description: " + str(self.view.params.requestDes) + ". Your request was deleted by " + str(self.session.props.auth.user.firstName) + ", their ID is " + str(self.session.props.auth.user.id) + ".", html=1, to= str(self.view.params.memberEmail))`
```

---

<div class="post-metadata">

**Author:** ![Kevin.Herron](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/kevin.herron/32/7259_2.png) [@Kevin.Herron](https://forum.inductiveautomation.com/u/Kevin.Herron)\
**Post date:** [March 24, 2021, 4:03pm UTC](https://forum.inductiveautomation.com/t/send-email-to-user-only-if-their-id-is-not-null/44862/2 "2021-03-24T16:03:00Z")

</div>

try:

```auto
if self.view.params.memberID != None:

```

---

<div class="post-metadata">

**Author:** ![seanbuckley2698](https://avatars.discourse-cdn.com/v4/letter/s/d6d6ee/32.png) [@seanbuckley2698](https://forum.inductiveautomation.com/u/seanbuckley2698)\
**Post date:** [March 24, 2021, 4:12pm UTC](https://forum.inductiveautomation.com/t/send-email-to-user-only-if-their-id-is-not-null/44862/3 "2021-03-24T16:12:09Z")

</div>

Thanks, Kevin, that has done the trick.
