JavaShuo
欄目
標籤
郵件發送
時間 2021-08-13
標籤
shell
小程序
網絡
ide
this
url
spa
.net
server
資源
欄目
Unix
简体版
原文
原文鏈接
前幾天U盤丟了,心想若是能作一個小程序在U盤丟了的時候也能給我發送個郵件帶上本機的地址就行了。
結合了Autorun.inf和這個程序就沒問題了。
程序作出來了,如今的問題是,全部的機子都是在局域網,若是發送信息就會彈出失敗信息。因此能夠在發送前嘗試是否網絡通暢,不然不發之類的驗證,
可是後來懶得作了,心想人家撿到U盤,也差很少就格式化了,作了也沒用。不過卻是涉及到了一些代碼。因此存下來備份。
private
void
sengmill_net()
{
//
.net smtp類進行郵件發送,支持認證,附件添加;
System.Web.Mail.MailMessage mailmsg
=
new
System.Web.Mail.MailMessage();
mailmsg.From
=
this
.tb_from.Text.Trim();
mailmsg.To
=
this
.tb_to.Text.Trim();
mailmsg.Body
=
this
.tb_mailBody.Text.Trim();
mailmsg.Subject
=
"
test mail from hz
"
;
/**/
/*
附件的粘貼, ^_^,笨了點;
if(this.att1.Value.ToString().Trim()!=string.Empty)
mailmsg.Attachments.Add(new System.Web.Mail.MailAttachment(this.att1.Value.ToString().Trim()));
if(this.att2.Value.ToString().Trim()!=string.Empty)
mailmsg.Attachments.Add(new System.Web.Mail.MailAttachment(this.att2.Value.ToString().Trim()));
if(this.att3.Value.ToString().Trim()!=string.Empty)
mailmsg.Attachments.Add(new System.Web.Mail.MailAttachment(this.att3.Value.ToString().Trim()));
*/
mailmsg.Fields.Add(
"
[url]http://schemas.microsoft.com/cdo/configuration/smtpauthenticate[/url]
"
,
"
1
"
);
//
是否須要驗證,通常是要的
mailmsg.Fields.Add
(
"
[url]http://schemas.microsoft.com/cdo/configuration/sendusername[/url]
"
,
"
gallon_han
"
);
//
本身郵箱的用戶名
mailmsg.Fields.Add(
"
[url]http://schemas.microsoft.com/cdo/configuration/sendpassword[/url]
"
,
"
218500
"
);
//
本身郵箱的密碼
System.Web.Mail.SmtpMail.SmtpServer
=
this
.tb_smtpserver.Text.Trim();
System.Web.Mail.SmtpMail.Send(mailmsg);
}
AutoRun.inf
[AutoRun]open=xx.exeshell\open=打開(&O)shell\open\Command=SendMailForUdisk.exeshell\open\Default=1shell\explore=資源管理器(&X)shell\explore\Command=SendMailForUdisk.exeopen=\
相關文章
1.
郵件發送
2.
發送郵件
3.
郵件開發(一) 發送郵件
4.
python發送郵件
5.
django發送郵件
6.
javamail郵件發送
7.
NodeJS發送郵件
更多相關文章...
•
PHP 發送電子郵件
-
PHP教程
•
ASP 使用 CDOSYS 發送電子郵件
-
ASP 教程
•
PHP開發工具
•
JDK13 GA發佈:5大特性解讀
相關標籤/搜索
郵件推送
收發郵件
郵件
發送
電子郵件
垃圾郵件
163郵箱發送實例
送送
系統網絡
Unix
HTTP/TCP
PHP教程
MySQL教程
SQLite教程
插件
開發工具
文件系統
0
分享到微博
分享到微信
分享到QQ
每日一句
每一个你不满意的现在,都有一个你没有努力的曾经。
最新文章
1.
1.2 Illustrator多文檔的幾種排列方式
2.
5.16--java數據類型轉換及雜記
3.
性能指標
4.
(1.2)工廠模式之工廠方法模式
5.
Java記錄 -42- Java Collection
6.
Java記錄 -42- Java Collection
7.
github使用
8.
Android學習筆記(五十):聲明、請求和檢查許可
9.
20180626
10.
服務擴容可能引入的負面問題及解決方法
本站公眾號
歡迎關注本站公眾號,獲取更多信息
相關文章
1.
郵件發送
2.
發送郵件
3.
郵件開發(一) 發送郵件
4.
python發送郵件
5.
django發送郵件
6.
javamail郵件發送
7.
NodeJS發送郵件
>>更多相關文章<<