#定义函数
$mailaddr = “邮件地址@mail.com”
$body = “邮件内容~~”
function sendmail($mailaddr,$body){
$msg=New-Object System.Net.Mail.MailMessage
$msg.To.Add($mailaddr)
$msg.From = New-Object System.Net.Mail.MailAddress(“[email protected]”, “发件人”,[system.Text.Encoding]::GetEncoding(“UTF-8”))
$msg.Subject = “邮件标题”
$msg.SubjectEncoding = [system.Text.Encoding]::GetEncoding(“UTF-8”)
$msg.Body =$body
$Attachments=New-Object System.Net.Mail.Attachment(“D:\vminfo.xlsx”)#创建附件
$msg.Attachments.add($Attachments) #添加附件,英文名可多个,中文名就只能带一个。
$msg.BodyEncoding = [system.Text.Encoding]::GetEncoding(“UTF-8”)
$msg.IsBodyHtml = $false#发送html格式邮件
#$msg.Priority = [System.Net.Mail.MailPriority]::High
$client = New-Object System.Net.Mail.SmtpClient(“smtp-mail.outlook.com”)
$client.EnableSsl = $true
$client.UseDefaultCredentials = $false
$client.Credentials=New-Object System.Net.NetworkCredential(“[email protected]”, “password”)
try {$client.Send($msg)}
catch [Exception]{$($_.Exception.Message)
$mailaddr
} }
#发送邮件
sendmail $mailaddr $body
附另外一种写法:
$mailaddr = "收件人邮件地址" $SMTPServer = "smtp-mail.outlook.com" $SMTPPort = "587" $Username = "发件人@outlook.com" $Password = "mail password" $body = "mail body; " function sendmail($mailaddr,$body){ $msg=New-Object System.Net.Mail.MailMessage $msg.To.Add($mailaddr) $msg.From = New-Object System.Net.Mail.MailAddress("发件人@outlook.com", "dacat",[system.Text.Encoding]::GetEncoding("UTF-8")) $msg.Subject = "主题日报表" $msg.SubjectEncoding = [system.Text.Encoding]::GetEncoding("UTF-8") $msg.Body =$body $Attachments=New-Object System.Net.Mail.Attachment("D:\vminfo.xlsx") $msg.Attachments.add($Attachments) $msg.BodyEncoding = [system.Text.Encoding]::GetEncoding("UTF-8") $msg.IsBodyHtml = $true#发送html格式邮件 #$msg.Priority = [System.Net.Mail.MailPriority]::High $client = New-Object System.Net.Mail.SmtpClient($SMTPServer,$SMTPPort); $client.EnableSsl = $true $client.UseDefaultCredentials = $false $client.Credentials=New-Object System.Net.NetworkCredential($Username, $Password); try {$client.Send($msg)} catch [Exception]{$($_.Exception.Message) $mailaddr } } sendmail $mailaddr $body
I loved your blog.Much thanks again. Want more.
Fantastic post.Much thanks again. Keep writing.
I really enjoy the blog post.Really looking forward to read more. Cool.
Im grateful for the post.Really thank you! Will read on…
There’s certainly a lot to know about this issue. I like all of the points you have made.
It’s impressive that you are getting thoughts from this
post as well as from our argument made at this time.
Great post.Much thanks again. Fantastic.
Great, thanks for sharing this blog post.Much thanks again. Want more.
I truly appreciate this article.Thanks Again. Great.
Great blog you have got here.. It’s difficult to find high-quality writing like yours nowadays. I honestly appreciate people like you! Take care!!
Very informative article.Thanks Again. Really Great.
I really liked your article post. Awesome.
Major thankies for the blog.Really thank you! Really Great.
I value the blog.Thanks Again. Great.
Very neat article post.Thanks Again. Great.
Really appreciate you sharing this article post. Want more. Frederica Yancy Faus
Incredible story there. What happened after? Thanks!
Excellent post. I was checking continuously this blog and I’m impressed!
Extremely helpful information specially the last part 🙂 I
care for such info much. I was looking for this particular info for a very long time.
Thank you and best of luck.
Very informative blog.Thanks Again. Cool.
I cannot thank you enough for the post.Really looking forward to read more. Great.
Thank you for sharing your info. I really appreciate your effortsand I will be waiting for your next write ups thank you once again.
Awesome blog.Much thanks again. Keep writing.
Hi, yes this post is genuinely nice and I have learned lot of things from it regarding blogging.
thanks.
Major thanks for the blog.Really looking forward to read more. Fantastic.
I appreciate you sharing this blog article.Really looking forward to read more. Will read on…
Hello to every one, since I am truly keen of
reading this website’s post to be updated daily.
It carries fastidious information.
Thanks a lot for the blog.Really looking forward to read more. Really Great.
Thanks-a-mundo for the article post. Awesome.
You’re so awesome! I don’t believe I’ve read through a single thing like this before.
So nice to find someone with unique thoughts on this topic.
Really.. thank you for starting this up.
This site is something that is needed on the internet, someone with
some originality!
My family all the time say that I am killing my time here at web, however I know I
am getting know-how daily by reading such good content.
Thanks for the good writeup. It in reality was once a leisure account it.
Glance complex to more introduced agreeable from you!
By the way, how can we communicate?
At this time it sounds like Expression Engine is the top blogging platform out there right now.
(from what I’ve read) Is that what you’re using on your
blog?
Great blog article.
Hello, after reading this remarkable piece of writing i am also cheerful to
share my knowledge here with friends.
[url=https://lisinopril.directory/]zestoretic 25[/url]
Hi there, this weekend is fastidious designed for me,
because this occasion i am reading this great educational post here at my house.
I loved your article post.Thanks Again. Keep writing.
I really liked your article.Much thanks again. Awesome.
When I initially commented I clicked the “Notify me when new comments are added” checkbox and now each time a comment is added I get several e-mails with the same
comment. Is there any way you can remove me from that service?
Bless you!
Heya i’m for the first time here. I came across this board and I find
It truly useful & it helped me out a lot.
I hope to give something back and aid others like you helped me.
Wow that was odd. I just wrote an incredibly long comment but
after I clicked submit my comment didn’t show
up. Grrrr… well I’m not writing all that over again. Anyhow, just wanted to say wonderful blog!
Hello, Neat post. There is an issue with your web site in internet explorer, could check this?
IE nonetheless is the marketplace chief and a big component of
other people will miss your great writing due to this problem.
Hmm it looks like your blog ate my first comment (it was extremely long) so
I guess I’ll just sum it up what I had written and say, I’m thoroughly enjoying your
blog. I as well am an aspiring blog writer but I’m still new to everything.
Do you have any points for rookie blog writers? I’d certainly
appreciate it.
A big thank you for your article.Really looking forward to read more. Much obliged.
I loved your article.Really looking forward to read more.
Thanks for sharing, this is a fantastic blog.Really thank you! Cool.
I really love your site.. Excellent colors & theme.
Did you develop this amazing site yourself? Please reply back
as I’m attempting to create my own personal website and would like to find out where you got this
from or exactly what the theme is named. Cheers!
This is a good tip especially to those fresh to the blogosphere.
Simple but very accurate info… Many thanks for
sharing this one. A must read post!
Thanks for sharing, this is a fantastic article.Really looking forward to read more. Really Great.
Very nice post. I definitely appreciate this website.
Keep it up!
I was very happy to uncover this page. I wanted
to thank you for ones time for this fantastic read!! I definitely appreciated every bit of it and I have
you saved as a favorite to check out new stuff in your website.
Awesome article post.Really thank you! Really Cool.
valley vet ivermectin can you use ivermectin on cats
Say, you got a nice article.Thanks Again. Much obliged.
I have been surfing online more than 3 hours today,
but I never found any attention-grabbing article like yours.
It’s pretty value sufficient for me. Personally, if all web owners and bloggers made excellent content material
as you did, the web can be a lot more helpful than ever before.
Necessary to compose you a very little word to thanks all over again regarding the good ideas you’ve contributed right here.
Major thanks for the blog post.Thanks Again. Want more.
Awesome article.
Thanks for sharing, this is a fantastic blog.Really looking forward to read more. Much obliged.
I am so grateful for your article post.Thanks Again. Really Cool.
Thanks for sharing, this is a fantastic blog. Really Cool.
Looking forward to reading more. Great blog.Much thanks again. Really Cool.
If you wish for to take much from this piece of writing then you have to apply such
strategies to your won blog.
What’s up, just wanted to say, I loved this post. It was inspiring. Keep on posting!
Really appreciate you sharing this blog post.Thanks Again. Keep writing.
Wow, great article post.Much thanks again. Cool.
I’ll immediately take hold of your rss as I can not to find your email subscription link or newsletter service. Do you have any? Kindly allow me realize in order that I could subscribe. Thanks.
Major thanks for the article post.Thanks Again. Really Cool.
I really enjoy the blog. Want more.
I really liked your article post. Really Cool.
Thanks again for the blog article.Thanks Again. Cool.
I think this is a real great article.Much thanks again. Really Cool.
[url=http://tretinoin.shop/]where to buy retin a cream[/url]
Thanks again for the blog.Thanks Again. Want more.
Yes! Finally someone writes about energy healing with energy.
I cannot thank you enough for the blog post.Much thanks again. Want more.
Very informative blog post.Really looking forward to read more. Much obliged.
My partner and I absolutely love your blog and find nearly all of your post’s to be what precisely I’m looking for.
Would you offer guest writers to write content for
you? I wouldn’t mind composing a post or elaborating on some of the subjects you write related to
here. Again, awesome web log!
Normally I don’t read post on blogs, but I would like tosay that this write-up very forced me to try and doit! Your writing style has been amazed me.Thank you, quite great article.
Thanks-a-mundo for the article post. Really Cool.
When some one searches for his necessary thing,
thus he/she desires to be available that in detail, so that thing is maintained over here.
Muchos Gracias for your article. Fantastic.
tadalafil and dapoxetine reviews is tadalafil from india safe
Thanks-a-mundo for the blog.Really looking forward to read more. Fantastic.
I have found excellent articles here. I adorethe way you compose. Good!
I loved your blog.
Very informative blog.Really looking forward to read more.
Thank you for your post.Really looking forward to read more. Want more.
Awesome blog.Really thank you! Much obliged.
I value the post.Thanks Again. Great.
This is one awesome blog.
Looking forward to reading more. Great blog article. Want more.
I value the article.Really thank you!
Great, thanks for sharing this blog post.Really looking forward to read more. Really Great.
A round of applause for your article. Much obliged.
Looking forward to reading more. Great blog post.Much thanks again. Awesome.
Hey, thanks for the post.Much thanks again. Really Cool.
I enjoy what you guys are up too. This type of clever work and reporting! Keep up the terrific works guys I’ve incorporated you guys to my own blogroll.
Hey there! I’m at work browsing your blog from my new iphone 3gs!Just wanted to say I love reading your blog and look forward to all your posts!Keep up the superb work!
herbal ed blue pill from canada – best erectile dysfunction pills
Thanks for sharing, this is a fantastic article post.Thanks Again. Really Cool.
Thanks for the post.Really looking forward to read more. Much obliged.
I really liked your post.Thanks Again. Want more.
hi I am an adult female age 37 love to talk more.
Thanks-a-mundo for the article.Thanks Again. Really Great.
Mong Chang Cafe, a popular cafe in Pattaya Located in Pattaya Elephant Village near Nong Prue Municipality It is a unique cafe with good atmosphere in the midst of green areas.
An effective way acquiring a new generation in the planet.To accept One heard about BT I did have virtually no queries that`sthis advantage! And, then why not a minimal facilitate this short post?))
A big thank you for your article post.Really looking forward to read more. Really Cool.
Enjoyed every bit of your blog post.Thanks Again.
Enjoyed looking at this, very good stuff, thanks . „Talk sense to a fool and he calls you foolish.” by Euripides.
[url=https://viagra150mgnorx.quest/]pill viagra[/url]
Kako forex radi. https://ba.forex-stock-bitcoin-brokers.com
Fearr ea forex. https://ie.forex-stock-bitcoin-brokers.com