351
General Software Discussion / Re: Looking for a Mass Mailer
« Last post by 4wd on March 20, 2020, 04:57 AM »Possibly something simple like this:
MassBlatter.ps1
Where, (for example):
emails.csv
panic.html
Image as in my post above.
Put MassBlatter.ps1, Blat.exe, panic.html, emails.csv, and any image referenced in the same folder then run the PoSh script, (after editing naturally).
NOTE: I hardly need to point out to you that the ramifications of a plain text user/password - if the server doesn't require them, omit the -u, -pw parameters from the arguments. Same with the SMTP port - not required, omit it.
DISCLAIMER: Haven't tested it since I don't have access to a SMTP server but the script ran through my test list and printed out the right command parameters ... I'm sure you'd be able to test it locally
PS. WTF do they want a fancy font for? It's supposed to be serious not an invitation.
PPS. Haven't taken into account spaces in filenames, just don't do it.
MassBlatter.ps1
Code: PowerShell [Select]
- $SmtpServer = "smtp.domain.com"
- $SmtpPort = 25 # If it's required
- $User = "admin" # If it's required
- $Password = "password" # If it's required
- $Subject = "Panic Now, Avoid The Rush!"
- $HtmlBody = ".\panic.html"
- $Embed = ".\KC.jpg" # You can add more, just comma separate them, insert
- # CID tags in HTML as appropriate
- $Attachments = ".\file1.zip,.\file2.doc"
- # Import email addresses from .CSV file
- $Users = Import-Csv emails.csv
- # Send email to each address in the list
- Foreach ($User in $Users) {
- $ToAddress = $User.Email
- $blatArgs = "-server $($SmtpServer) -port $($SmtpPort) -u $($User) -pw $($Password) -to $($ToAddress) `
- -replyto $($ReplyTo) -subject `"$($Subject)`" -bodyF $($HtmlBody) -html -embed $($Embed) `
- -attach $($Attachments)"
- Write-Host "Sending notification to $Name ($ToAddress)" -ForegroundColor Yellow
- Start-Process -FilePath .\Blat.exe -ArgumentList $blatArgs -WorkingDirectory . -Wait
- Start-Sleep -Milliseconds 500
- }
Where, (for example):
emails.csv
Code: Text [Select]
panic.html
Code: Text [Select]
- Dear Client,
- As you know in this trying time of crazy weather, stupid governments,
- and incessant bickering relatives, we have now learnt that Nature
- is out to eliminate us with a virus for all the wrong we have done to the planet.
- Having looked at this problem logically we have determined that there is really only one coarse of action:
- <img src="cid:KC.jpg">
- Yours Sincerely,
- Fin Dusinpub
Image as in my post above.
Put MassBlatter.ps1, Blat.exe, panic.html, emails.csv, and any image referenced in the same folder then run the PoSh script, (after editing naturally).
NOTE: I hardly need to point out to you that the ramifications of a plain text user/password - if the server doesn't require them, omit the -u, -pw parameters from the arguments. Same with the SMTP port - not required, omit it.
DISCLAIMER: Haven't tested it since I don't have access to a SMTP server but the script ran through my test list and printed out the right command parameters ... I'm sure you'd be able to test it locally

PS. WTF do they want a fancy font for? It's supposed to be serious not an invitation.
PPS. Haven't taken into account spaces in filenames, just don't do it.

Recent Posts


