SMTP relay-Script

Hi ,

We are using  script in Active roles to send emails to the users. currently the script uses a username and a password to connect to exchange office365 as per below, we would like to use SMTP relay  to modify the below script , can you please let me know how to change this script to use SMTP relay or any other way which is more secure rather than using txt file to call the password.

$smtpServer = "smtp.office365.com"
$from = "support@abc.com"
$smtpServer = "smtp.office365.com"
$from = "support@abc.com"
$SmtpUser = "new-svc@abc.com"
$smtpPassword = Get-Content "D:\AR User\smtpcredabc.txt"
$cred = New-Object System.Management.Automation.PSCredential -ArgumentList $SmtpUser, $($smtpPassword | ConvertTo-SecureString -AsPlainText -Force)


Send-MailMessage -smtpServer $smtpServer -from $from -to $email -subject $subject -body $body -bodyasHTML -Port 587 -priority High -ErrorAction Stop -UseSsl -credential $cred -attachment $attachment