Sometimes in my scripts I need to send the result in a mail, but I don’t always have access to a SMTP server, so I decided to configure a SMTP server in Azure that I can use.
I will use SendGrid Email Delivery for this since I will get 25.000 free emails each month, more than I will ever use.
The first thing is to log on to Azure and find SendGrid Email Delivery in the market:
When you click on create you will be prompted to enter some information for the new account that will be used to access the SMTP server. Specify a name for the account, a password, resource group and select the “Free” option under “Pricing tier”.
When you click on “Create” you will be sent to the dashboard and after a few minutes you will see that the account has been pined and ready for use.
If you click on the account you will be redirected to the settings-page where you will find the SMTP-address and the “real” account name that you will use to gain access to the SMTP.
Now you have access to a SMTP-server that you can use to send 25.000 mails through.
A simple script that you can use to test the function is posted here, just change the parts contained in <> to your own settings.
$From = "sender@test.com" $To = "<Your Mailaddress>" $SMTPServer = "smtp.sendgrid.net" $SMTPPort = "587" $Username = "<Your SendGrid username>" $Password = "<Your SendGrid password>" $subject = "Test" $body = "This is a testmail using SendGrid Email Delivery" $smtp = New-Object System.Net.Mail.SmtpClient($SMTPServer, $SMTPPort) $smtp.EnableSSL = $true $smtp.Credentials = New-Object System.Net.NetworkCredential($Username, $Password) $smtp.Send($From, $To, $subject, $body)
Nice article you did there!
Just a few word to say you that Mailjet has also landed on Microsoft Azure! Do you think it could deserve another article?
Longing for hearing from you,
Grégory from the Mailjet team 🙂
Hi Grégory!
I’ll see what I can come up with regarding this, just added it to my subscription and so far everything is looking good!
If you have any input on what you’d like in the article, send me a message on LinkedIn or Twitter (Listed under “About Me”)
Best regards
Andreas Molin
hi admin did you have email i have a question
Hi!
Normally I don’t give away my mail, but you can reach me at any of the listed items on this page: https://guidestomicrosoft.com/about-me/
Hi admin,
I’m trying to grasp an issue I am having where I need an IRM solution to classify emails but I also need the ability to send classified emails externally. Is it possible to set an Azure IRM solution up in such a way then when I send an email I get the following classification options:
– Unclassified
– IN confidence (cannot leave internal)
– Restricted (cannot leave internal)
– Restricted External (sent to external via SMTP relay)
Any insights would be great
Hi Simon!
This should be possible by using Azure Information Protection.
I haven’t tried this myself, but I think it will meet your needs!
You can read more about it here:
//Andreas
Thank you for this, saved me the trouble of installing XAMPP -Mercury on my Azure VM
Hi Admin,
I need to configure and send mail using sendgrid from Azure SQL Managed Instance.
I configured using below link, but still no able to send mail.
https://www.mssqltips.com/sqlservertip/4507/sql-server-database-mail-configured-with-the-send-grid-email-service-in-the-azure-market-place/
Error:
Could not connect to mail server. (A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond 169.38.103.42:25).
I am able to telnet smtp.sendgrid.net 25 also from my server.
Can you guide me how to configure.
Thanks in advance
Hi,
Unfortunately I don’t have much knowledge in sending mail from databases, but my best guess is that there is an error in your configuration in the database.
Have you verified that all settings are correct? I’m thinking in the last section of the post where you configure the database.
Best regards
Andreas Molin