Save recurring script configurations in your PowerShell profile and have them always available via the $PSSCriptConfig variable.
Install-Module PSScriptConfig
Import-Module PSScriptConfig
Register-PSScriptConfig
New-PSScriptConfig -Key mailRelay -Value mail.contoso.com
New-PSScriptConfig -Key mailRelayPort -Value 25
New-PSScriptConfig -Key mailFrom -Value admin@contoso.com
$PSScriptConfig
$PSScriptConfig.mailRelay
For the current session only.
$PSScriptConfig.mailRelay = "smtp.contoso.com"
Save permanently.
Save-PSScriptConfig
Remove-PSScriptConfig -Key mailRelay
Send-MailMessage -From $PSScriptConfig.mailFrom -SmtpServer $PSScriptConfig.mailRelay -Port $PSScriptConfig.mailRelayPort -To me@contoso.com -Subject test