使用邮件调度程序发送邮件 [英] Send mail using mail Scheduler

查看:125
本文介绍了使用邮件调度程序发送邮件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何使用vb.net中的邮件调度程序按时间,日/月/年发送邮件

how to send mail using mail scheduler in vb.net by time ,Day/Month/year

推荐答案

这里是用于在C#.Net中发送邮件的代码。



MailMessage message = new MailMessage();

SmtpClient smtpClient = new SmtpClient();



string msg = string.Empty;

try

{

MailAddress fromAddress = new MailAddress(from);

message.From = fromAddress;

message.To.Add(test@gmail.com);

if(ccList!= null && ccList!= string.Empty)

message.CC.Add(test@gmail.com);

message.Subject = subject;

message.IsBodyHtml = true;

message.Body =邮件正文;

smtpClient.Host =smtp.gmail.com; //我们使用gmail作为我们的smtp客户端

smtpClient.Port = 587;

smtpClient.EnableSsl = true;

smtpClient.UseDefaultCredentials = true ;

smtpClient.Credentials = new System.Net.NetworkCredential(yourmail@gmail.com,password);



smtpClient 。发送(消息);

msg =成功;

}

catch(例外情况)

{

msg = ex.Message;

}



这可能对你有帮助。
here is code for send mail in C#.Net.

MailMessage message = new MailMessage();
SmtpClient smtpClient = new SmtpClient();

string msg = string.Empty;
try
{
MailAddress fromAddress = new MailAddress(from);
message.From = fromAddress;
message.To.Add("test@gmail.com");
if (ccList != null && ccList != string.Empty)
message.CC.Add("test@gmail.com");
message.Subject = subject;
message.IsBodyHtml = true;
message.Body = "Mail body";
smtpClient.Host = "smtp.gmail.com"; // We use gmail as our smtp client
smtpClient.Port = 587;
smtpClient.EnableSsl = true;
smtpClient.UseDefaultCredentials = true;
smtpClient.Credentials = new System.Net.NetworkCredential("yourmail@gmail.com", "password");

smtpClient.Send(message);
msg = "Successful";
}
catch (Exception ex)
{
msg = ex.Message;
}

this may help you.


检查此链接:

在特定时间内向用户发送自动电子邮件 [ ^ ]


您可以创建邮件控制台应用程序并根据您的要求进行安排。

邮件对象在.net
you can create mail console application and scheduled it as per your requirement.
mail objects are available in .net

中提供

这篇关于使用邮件调度程序发送邮件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆