# Old way — deprecated, insecure, requires SMTP config
Send-MailMessage ` -From "[email protected]" ` -To "[email protected]" ` -Subject "Daily Report" ` -Body "See attached." ` -Attachments "report.csv" ` -SmtpServer "smtp.office365.com" ` -Port 587 ` -UseSsl ` -Credential (Get-Credential)
# Old way — deprecated, insecure, requires SMTP config
Send-MailMessage ` -From "[email protected]" ` -To "[email protected]" ` -Subject "Daily Report" ` -Body "See attached." ` -Attachments "report.csv" ` -SmtpServer "smtp.office365.com" ` -Port 587 ` -UseSsl ` -Credential (Get-Credential)
# Old way — deprecated, insecure, requires SMTP config
Send-MailMessage ` -From "[email protected]" ` -To "[email protected]" ` -Subject "Daily Report" ` -Body "See attached." ` -Attachments "report.csv" ` -SmtpServer "smtp.office365.com" ` -Port 587 ` -UseSsl ` -Credential (Get-Credential)
# New way — OAuth, no SMTP, no credentials in scripts
nylas email send ` --to "[email protected]" ` --subject "Daily Report" ` --body "See attached." ` --attach "report.csv" ` --yes
# New way — OAuth, no SMTP, no credentials in scripts
nylas email send ` --to "[email protected]" ` --subject "Daily Report" ` --body "See attached." ` --attach "report.csv" ` --yes
# New way — OAuth, no SMTP, no credentials in scripts
nylas email send ` --to "[email protected]" ` --subject "Daily Report" ` --body "See attached." ` --attach "report.csv" ` --yes
# One-line -weight: 500;">install via PowerShell
irm https://cli.nylas.com/-weight: 500;">install.ps1 | iex # Verify
nylas --version
# One-line -weight: 500;">install via PowerShell
irm https://cli.nylas.com/-weight: 500;">install.ps1 | iex # Verify
nylas --version
# One-line -weight: 500;">install via PowerShell
irm https://cli.nylas.com/-weight: 500;">install.ps1 | iex # Verify
nylas --version
nylas auth login
nylas auth whoami
# => Authenticated as [email protected] (Microsoft 365)
nylas auth login
nylas auth whoami
# => Authenticated as [email protected] (Microsoft 365)
nylas auth login
nylas auth whoami
# => Authenticated as [email protected] (Microsoft 365)
# Before (Send-MailMessage)
Send-MailMessage -To "[email protected]" -Subject "Build failed" ` -Body "CI pipeline failed at $(Get-Date)" -SmtpServer "smtp.gmail.com" # After (Nylas CLI)
nylas email send --to "[email protected]" ` --subject "Build failed" ` --body "CI pipeline failed at $(Get-Date)" --yes
# Before (Send-MailMessage)
Send-MailMessage -To "[email protected]" -Subject "Build failed" ` -Body "CI pipeline failed at $(Get-Date)" -SmtpServer "smtp.gmail.com" # After (Nylas CLI)
nylas email send --to "[email protected]" ` --subject "Build failed" ` --body "CI pipeline failed at $(Get-Date)" --yes
# Before (Send-MailMessage)
Send-MailMessage -To "[email protected]" -Subject "Build failed" ` -Body "CI pipeline failed at $(Get-Date)" -SmtpServer "smtp.gmail.com" # After (Nylas CLI)
nylas email send --to "[email protected]" ` --subject "Build failed" ` --body "CI pipeline failed at $(Get-Date)" --yes
# Before
Send-MailMessage -To "[email protected]" -Subject "Monthly Report" ` -Body "Report attached." -Attachments "C:\Reports\monthly.xlsx" ` -SmtpServer "smtp.office365.com" -Port 587 -UseSsl -Credential $cred # After
nylas email send --to "[email protected]" ` --subject "Monthly Report" ` --body "Report attached." ` --attach "C:\Reports\monthly.xlsx" --yes
# Before
Send-MailMessage -To "[email protected]" -Subject "Monthly Report" ` -Body "Report attached." -Attachments "C:\Reports\monthly.xlsx" ` -SmtpServer "smtp.office365.com" -Port 587 -UseSsl -Credential $cred # After
nylas email send --to "[email protected]" ` --subject "Monthly Report" ` --body "Report attached." ` --attach "C:\Reports\monthly.xlsx" --yes
# Before
Send-MailMessage -To "[email protected]" -Subject "Monthly Report" ` -Body "Report attached." -Attachments "C:\Reports\monthly.xlsx" ` -SmtpServer "smtp.office365.com" -Port 587 -UseSsl -Credential $cred # After
nylas email send --to "[email protected]" ` --subject "Monthly Report" ` --body "Report attached." ` --attach "C:\Reports\monthly.xlsx" --yes
# Before
Send-MailMessage -To "[email protected]" -Cc "[email protected]" ` -Bcc "[email protected]" -Subject "Sprint -weight: 500;">update" ` -Body "All tasks on track." -SmtpServer "smtp.gmail.com" # After
nylas email send --to "[email protected]" ` --cc "[email protected]" --bcc "[email protected]" ` --subject "Sprint -weight: 500;">update" --body "All tasks on track." --yes
# Before
Send-MailMessage -To "[email protected]" -Cc "[email protected]" ` -Bcc "[email protected]" -Subject "Sprint -weight: 500;">update" ` -Body "All tasks on track." -SmtpServer "smtp.gmail.com" # After
nylas email send --to "[email protected]" ` --cc "[email protected]" --bcc "[email protected]" ` --subject "Sprint -weight: 500;">update" --body "All tasks on track." --yes
# Before
Send-MailMessage -To "[email protected]" -Cc "[email protected]" ` -Bcc "[email protected]" -Subject "Sprint -weight: 500;">update" ` -Body "All tasks on track." -SmtpServer "smtp.gmail.com" # After
nylas email send --to "[email protected]" ` --cc "[email protected]" --bcc "[email protected]" ` --subject "Sprint -weight: 500;">update" --body "All tasks on track." --yes
# Before
Send-MailMessage -To "[email protected]" -Subject "Status" ` -Body "<h1>All Green</h1><p>No incidents today.</p>" ` -BodyAsHtml -SmtpServer "smtp.office365.com" # After
nylas email send --to "[email protected]" ` --subject "Status" ` --body "<h1>All Green</h1><p>No incidents today.</p>" --yes
# Before
Send-MailMessage -To "[email protected]" -Subject "Status" ` -Body "<h1>All Green</h1><p>No incidents today.</p>" ` -BodyAsHtml -SmtpServer "smtp.office365.com" # After
nylas email send --to "[email protected]" ` --subject "Status" ` --body "<h1>All Green</h1><p>No incidents today.</p>" --yes
# Before
Send-MailMessage -To "[email protected]" -Subject "Status" ` -Body "<h1>All Green</h1><p>No incidents today.</p>" ` -BodyAsHtml -SmtpServer "smtp.office365.com" # After
nylas email send --to "[email protected]" ` --subject "Status" ` --body "<h1>All Green</h1><p>No incidents today.</p>" --yes
# List recent emails
nylas email list --limit 10 # Search
nylas email search "invoice" --json | ConvertFrom-Json # Unread count
(nylas email list --unread --json | ConvertFrom-Json).Count
# List recent emails
nylas email list --limit 10 # Search
nylas email search "invoice" --json | ConvertFrom-Json # Unread count
(nylas email list --unread --json | ConvertFrom-Json).Count
# List recent emails
nylas email list --limit 10 # Search
nylas email search "invoice" --json | ConvertFrom-Json # Unread count
(nylas email list --unread --json | ConvertFrom-Json).Count
# Send tomorrow morning
nylas email send --to "[email protected]" ` --subject "Monday standup" --body "Agenda attached." ` --schedule "tomorrow 9am" --yes
# Send tomorrow morning
nylas email send --to "[email protected]" ` --subject "Monday standup" --body "Agenda attached." ` --schedule "tomorrow 9am" --yes
# Send tomorrow morning
nylas email send --to "[email protected]" ` --subject "Monday standup" --body "Agenda attached." ` --schedule "tomorrow 9am" --yes
Import-Csv contacts.csv | ForEach-Object { nylas email send ` --to $_.Email ` --subject "Hello $($_.Name)" ` --body "Your account is ready." --yes Start-Sleep -Seconds 2
}
Import-Csv contacts.csv | ForEach-Object { nylas email send ` --to $_.Email ` --subject "Hello $($_.Name)" ` --body "Your account is ready." --yes Start-Sleep -Seconds 2
}
Import-Csv contacts.csv | ForEach-Object { nylas email send ` --to $_.Email ` --subject "Hello $($_.Name)" ` --body "Your account is ready." --yes Start-Sleep -Seconds 2
}
# Create a scheduled task that sends a daily report
$Action = New-ScheduledTaskAction -Execute "nylas" ` -Argument 'email send --to "[email protected]" --subject "Daily Report" --body "Automated report" --yes'
$Trigger = New-ScheduledTaskTrigger -Daily -At "8:00AM"
Register-ScheduledTask -TaskName "DailyEmailReport" -Action $Action -Trigger $Trigger
# Create a scheduled task that sends a daily report
$Action = New-ScheduledTaskAction -Execute "nylas" ` -Argument 'email send --to "[email protected]" --subject "Daily Report" --body "Automated report" --yes'
$Trigger = New-ScheduledTaskTrigger -Daily -At "8:00AM"
Register-ScheduledTask -TaskName "DailyEmailReport" -Action $Action -Trigger $Trigger
# Create a scheduled task that sends a daily report
$Action = New-ScheduledTaskAction -Execute "nylas" ` -Argument 'email send --to "[email protected]" --subject "Daily Report" --body "Automated report" --yes'
$Trigger = New-ScheduledTaskTrigger -Daily -At "8:00AM"
Register-ScheduledTask -TaskName "DailyEmailReport" -Action $Action -Trigger $Trigger
# Poll for emails from a specific sender
nylas email list --from "[email protected]" --unread --json
# Poll for emails from a specific sender
nylas email list --from "[email protected]" --unread --json
# Poll for emails from a specific sender
nylas email list --from "[email protected]" --unread --json
# GitHub Actions
- name: Send deployment notification run: | nylas email send --to "[email protected]" \ --subject "Deployed v${{ github.ref_name }}" \ --body "Deployment complete." --yes
# GitHub Actions
- name: Send deployment notification run: | nylas email send --to "[email protected]" \ --subject "Deployed v${{ github.ref_name }}" \ --body "Deployment complete." --yes
# GitHub Actions
- name: Send deployment notification run: | nylas email send --to "[email protected]" \ --subject "Deployed v${{ github.ref_name }}" \ --body "Deployment complete." --yes - Office 365 Email from PowerShell
- Gmail OAuth in PowerShell
- Download Email Attachments in PowerShell - Send Email from PowerShell
- Send Email from the Command Line
- Automate Email and Calendar in PowerShell
- Best CLI Email Tools Compared
- Extract OTP Codes from Email
- E2E Email Testing with Playwright
- SPF, DKIM, DMARC Debugging