基本信息
源码名称:C#调用Outlook发送邮件实例源码
源码大小:0.04M
文件格式:.zip
开发语言:C#
更新时间:2013-01-24
友情提示:(无需注册或充值,赞助后即可获取资源下载链接)
嘿,亲!知识可是无价之宝呢,但咱这精心整理的资料也耗费了不少心血呀。小小地破费一下,绝对物超所值哦!如有下载和支付问题,请联系我们QQ(微信同号):813200300
本次赞助数额为: 2 元×
微信扫码支付:2 元
×
请留下您的邮箱,我们将在2小时内将文件发到您的邮箱
源码介绍
C#调用Outlook发送邮件
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
#region 查找与指定文件关联在一起的程序的文件名
/// <summary>
/// 查找与指定文件关联在一起的程序的文件名
/// </summary>
/// <param name="hwnd">窗口句柄</param>
/// <param name="lpOperation">指定字串“open”来打开lpFlie文档,或指定“Print”来打印它</param>
/// <param name="lpFile">想用关联程序打印或打开一个程序名或文件名</param>
/// <param name="lpParameters">如lpszFlie是可执行文件,则这个字串包含传递给执行程序的参数</param>
/// <param name="lpDirectory">想使用的完整路径</param>
/// <param name="nShowCmd">定义了如何显示启动程序的常数值</param>
/// <returns>非零表示成功,零表示失败</returns>
[DllImport("shell32.dll", EntryPoint = "ShellExecuteA")]
public static extern int ShellExecute(
IntPtr hwnd,
String lpOperation,
String lpFile,
String lpParameters,
String lpDirectory,
int nShowCmd
);
#endregion
private void button1_Click(object sender, EventArgs e)
{
if (textBox1.Text != "")
{
if (Regex.IsMatch(textBox1.Text, @"\w ([- .']\w )*@\w ([-.]\w )*\.\w ([-.]\w )*"))
ShellExecute(this.Handle, String.Empty, "mailto:" textBox1.Text, String.Empty, String.Empty, 1);
else
{
MessageBox.Show("请输入正确的邮箱格式");
textBox1.Text = string.Empty;
}
}
}
}