I have to send a daily update email and would like to know how I can have the email stubbed out automatically. I would probably add this to my start up, so each morning when I turn my computer on as well as launching Outlook and my browsers the email would be sitting ready for me to simply detail my morning and afternoon work. Only at the end of the day would I manually fill out the addresses to send it to.
Edit - 08/07/11 16:43
It soun开发者_开发百科ds, in hind-sight, like a template is what I want, one where the date is programmatically set in the subject and that I would like the templated email to be opened automatically 1st thing in the morningThe emails all take the same format; the subject line is "Daily update dd/mm/yy" Then in the body:
Morning
- List item
Afternoon
- List item
Here is the source of a small script sending an email in PowerShell :
Param([string[]] $to = $(throw "Please specifie a destination address"),
[string] $subject = "<No Subject>",
[string] $body = $(throw "Please specify message content"),
[string] $smtpHost = $(throw "please specify an SMTP server address"),
[string] $from = "$($env:UserName)@silogix-fr.com"
)
## Create the message
$email = New-Object System.Net.Mail.MailMessage
## Fill the fields
foreach($mailTo in $to)
{
$email.To.Add($mailTo)
}
$email.From = $from
$email.Subject = $subject
$email.Body = $body
## Send the message
$client = New-Object System.Net.Mail.SmtpClient $smtpHost
$client.UseDefaultCredentials = $true
$client.Send($email)
精彩评论