- I can't see a definite problem but from the manual I see,
smtpProfile
If specified, the named SMTP profile defined in the Gateway will be used. If this keyword is present, the smtp, username, and password keywords will be ignored. [optional]
So you can drop the smtp = smtp1
from sendEmail. Part of the idea here is that you would not hard-code the settings in your script but just point to the SMTP profile. Then if you ever change from Outlook.com you just have to edit that gateway's SMTP server setting and all scripts will continue to work.
-
Does smtp2 exactly match the name of the profile?
-
I recommend that you set the from address to something like
scriptname.projectname@servername.companyname.com
and construct this programmatically so that it auto-updates if the project is copied or moved to another server. It will be a big help in debugging quickly if the script goes rogue and your company's email gets blacklisted! -
Tip: post code - not pictures of code - unless context is important in which case you can post both. See Wiki - how to post code on this forum.