这一代码发送电子邮件的附件很容易。
代码说明:
This a COde to Send Emails with attachement very easily. You ca use it as an executable, or in you .Net project. Create you Form, create a Button and Enjoy. System::Void MyForm::SendOrder_Click(System::Object^ sender, System::EventArgs^ e) { List Items String ^Filename Filename = IO::Path::Combine(System::Environment::GetEnvironmentVariable("TEMP"), String::Concat("FCSSystem", IO::Path::GetRandomFileName(), ".txt")) Items.Add(Convert::ToString(DateTime::Now)) for(int ni=0 niControls->Count ni++) { Items.Add(String::Concat(OrderPanel->Controls[ni]->Controls[0]->Name,"Q", ((NumericUpDown^)OrderPanel->Controls[ni]->Controls[1])->Value)) } IO::File::WriteAllLines(Filename, Items.ToArray()) SendFileTo::MAPI mapi mapi.AddRecipientTo("sst@fcssystem.com") mapi.AddAttachment(Filename) mapi.SendMailPopup("FCS System Order", "Please Write Your Data Here")
下载说明:请别用迅雷下载,失败请重下,重下不扣分!