Version initiale
This commit is contained in:
34
sendMail.ps1
Normal file
34
sendMail.ps1
Normal file
@@ -0,0 +1,34 @@
|
||||
###################################
|
||||
# • SEND MAIL • #
|
||||
# Auteur : Morgan JUBAULT #
|
||||
###################################
|
||||
|
||||
##### MODIFIER A PARTIR D'ICI #####
|
||||
## PARAMETRES D'ENVOI DE MAIL
|
||||
# Modifiez les paramètres suivants pour configurer l'envoi de mail
|
||||
# Adresse du serveur SMTP
|
||||
$smtpServer = "smtp.example.com"
|
||||
# Port du serveur SMTP
|
||||
# Utilisez 587 pour TLS ou 465 pour SSL
|
||||
$smtpPort = 587
|
||||
# Adresse de l'expéditeur
|
||||
$from = "expediteur@example.com"
|
||||
# Adresse du destinataire
|
||||
$to = "destinataire@example.com"
|
||||
# Sujet du mail
|
||||
$subject = "Test d'envoi de mail via PowerShell"
|
||||
# Corps du mail
|
||||
$body = "Ceci est un mail envoyé depuis un script PowerShell."
|
||||
# Informations d'identification de l'expéditeur
|
||||
# Remplacez par vos informations d'identification SMTP
|
||||
$username = "expediteur@example.com"
|
||||
$password = "VotreMotDePasse" # Utilisez Get-Credential pour plus de sécurité
|
||||
##### NE PAS MODIFIER EN DESSOUS DE CETTE LIGNE #####
|
||||
|
||||
## CREATION DES CREDENTIALS
|
||||
$securePassword = ConvertTo-SecureString $password -AsPlainText -Force
|
||||
$cred = New-Object System.Management.Automation.PSCredential ($username, $securePassword)
|
||||
|
||||
|
||||
## ENVOI DU MAIL
|
||||
Send-MailMessage -From $from -To $to -Subject $subject -Body $body -SmtpServer $smtpServer -Port $smtpPort -Credential $cred -UseSsl
|
Reference in New Issue
Block a user