Comments on: The Many Ways to Send Email via the Microsoft Graph https://practical365.com/send-email-powershell-graph/ Practical Office 365 News, Tips, and Tutorials Thu, 19 Oct 2023 17:28:52 +0000 hourly 1 https://wordpress.org/?v=6.3.2 By: Tony Redmond https://practical365.com/send-email-powershell-graph/#comment-278004 Thu, 19 Oct 2023 17:28:52 +0000 https://practical365.com/?p=57352#comment-278004 In reply to Zaahir S.

Use an Azure Automation runbook to run the script to generate email to the new employees and schedule it to run at the end of the working day. https://practical365.com/use-azure-automation-exchange-online/

]]>
By: Zaahir S https://practical365.com/send-email-powershell-graph/#comment-277997 Thu, 19 Oct 2023 16:43:09 +0000 https://practical365.com/?p=57352#comment-277997 Hello

Great article and very informative.

I have created a script for new starters that does a number of actions then uses the built-in Send-MailMessage cmdlet to send a few emails, a welcome email to the new starter and couple other confirmation emails to other recipients.

The issue we now have is that they want the welcome emal to be sent on the new starters first day rather then when we process the script so i am looking at how we can achieve that, basically deferring/delaying the delivery of that welcome email. I can’t use Start-Sleep as it is not practical (for one we do multiple new starters in one batch and the start dates vary) and would rather employ a setting like Outlook desktop app has for deferring emails.

I started looking at the Graph API cmdlets as the built-in Send-MailMessage does not support it but it seems neither do these. Do you know if there is a way to achieve this using the new cmdlets or another practical way which is just in the script and NOT relying on doing something else, like scheduling a task to send?

Regards
Z

]]>
By: Tony Redmond https://practical365.com/send-email-powershell-graph/#comment-252729 Mon, 30 Jan 2023 10:06:57 +0000 https://practical365.com/?p=57352#comment-252729 In reply to Michael.

In the past, I have used a function to create the table of attachments for a message. Here’s what I use… the input is a simple array of attachment names.

Function Populate-Attachments {
[cmdletbinding()]
Param(
[array]$ListOfAttachments )
ForEach ($Attachment in $Attachments) {
Write-Host “Processing” $Attachment
$EncodedAttachmentFile = [Convert]::ToBase64String([IO.File]::ReadAllBytes($Attachment))
@{
“@odata.type”= “#microsoft.graph.fileAttachment”
name = ($Attachment -split ‘\\’)[-1]
contentBytes = $EncodedAttachmentFile
contentType = “text/plain”
}
}
}

]]>
By: Michael https://practical365.com/send-email-powershell-graph/#comment-252712 Mon, 30 Jan 2023 03:31:02 +0000 https://practical365.com/?p=57352#comment-252712 How do we go about attaching multiple attachments? I have tried to add an additional key but it detects this as a issue and does not allow it.

]]>