Whether for email of otherwise, you can either enter your creds in plain text in the script (as you are doing now), but really an ill-advised approach or store them in a secure file (the better option) and call them as needed.
There are tons of examples of this thought process all over the web and this forum as well. For example:
Quickly and securely storing your credentials – PowerShell
https://www.jaapbrasser.com/quickly-and-securely-storing-your-credentials-powershell
# To get a credential object we can either manually create one or use the Get-Credential cmdlet to prompt for the account details:
$Credential = Get-Credential
# To store the credentials into a .cred file:
$Credential | Export-CliXml -Path "${env:\userprofile}\Jaap.Cred"
# And to load the credentials from the file and back into a variable:
$Credential = Import-CliXml -Path "${env:\userprofile}\Jaap.Cred"
Invoke-Command -Computername 'Server01' -Credential $Credential {whoami}
Storing PowerShell Credentials in JSON
https://jdhitsolutions.com/blog/powershell/5396/storing-powershell-credentials-in-json
$secure = ConvertTo-SecureString -String 'P@$$w0rd' -AsPlainText -Force
$cred = New-Object -typename PSCredential -ArgumentList @('company\admin',$secure)
$cred | Export-clixml c:\work\admin.xml
Securely Store Credentials on Disk
http://powershellcookbook.com/recipe/PukO/securely-store-credentials-on-disk
# The first step for storing a password on disk is usually a manual one. There is nothing mandatory about the filename, but we’ll use a convention to name the file CurrentScript.ps1.credential. Given a credential that you’ve stored in the $credential variable, you can safely use the Export-CliXml cmdlet to save the credential to disk. Replace CurrentScript with the name of the script that will be loading it:
PS > $credPath = Join-Path (Split-Path $profile)
# CurrentScript.ps1.credential
PS > $credential | Export-CliXml $credPath
# In PowerShell version 2, you must use the ConvertFrom-SecureString cmdlet:
PS > $credPath = Join-Path (Split-Path $profile) CurrentScript.ps1.credential
PS > $credential.Password | ConvertFrom-SecureString | Set-Content $credPath
And this is a common question and thus your post request could be considered a duplicate of these:
Using PowerShell credentials without being prompted for a password
How to pass credentials to the Send-MailMessage command for sending emails