如何在C#中使用.NET 3.5和Visual Studio 2008以编程方式检查是否安装了打印机(如果有的话,我如何检查它是否已打开并准备好使用?)?
提前致谢,
如何在C#2008中打开Outlook Express?
如何将文件从我的应用程序附加到Outlook?
如何使用 c# 在电子邮件中附加多个文件。
MailMessage mail = new MailMessage();
SmtpClient SmtpServer = new SmtpClient("smtp.gmail.com");
//get the userID, Pass
userID= register.userName;
password = register.pass;
string aa=txtTo.Text;
mail.From = new MailAddress(userID);
mail.To.Add(aa);
mail.Subject = txtsubject.Text;
mail.Body = txtComments.Text;
//Attach file
mail.Attachments.Add(new Attachment(txtAttachments.Text.ToString()));
SmtpServer.Port = 587;
SmtpServer.UseDefaultCredentials = false;
SmtpServer.Credentials = new System.Net.NetworkCredential(userID, password);
SmtpServer.EnableSsl = true;
SmtpServer.Send(mail);
MessageBox.Show("Email sent successfully");
this.Cursor = Cursors.Default;
//close the page
Email email = new Email();
email.Close();
Run Code Online (Sandbox Code Playgroud)
此代码仅用于附加一个文件。如何在 c# 2008 中附加多个文件。???请给我解决方案。