当前位置:网站首页>[recommended by bloggers] C WinForm regularly sends email (with source code)
[recommended by bloggers] C WinForm regularly sends email (with source code)
2022-07-06 10:53:00 【xcLeigh】
List of articles
【 Bloggers recommend 】C# Winform Send email regularly ( Source code attached )
C# WinForm+Oracle+Email
1. Support for oracle Data regular query , Then send the query results to the email ;
2. Flexible and configurable , Log directory , Database related connections , The fields shown , The format of the presentation , Email sent , Form style, etc ;
3. On this basis , Support extended , Query data regularly ( Any database ), Send email ( SMS );
Form style
1. Support for minimization , Close hidden taskbar ;
2. The mailbox and database are configured , Start thread , Perform tasks ;
3. Output each processing data log
- Minimize the form
Form code
public ToDataEmail()
{
InitializeComponent();
// Default form maximization
//this.WindowState = System.Windows.Forms.FormWindowState.Maximized;
SysFinalUtil.appLog = txtSysLog.Text + "log";
SysFinalUtil.appLog2 = txtSysLog.Text;
this.txtMess.Text = WriteFileUtil.ReadTxt();
}
#region Thread start end
private void btnStart_Click(object sender, EventArgs e)
{
// SMS receiving thread
WriteFileUtil.WriteFileLog("--------------------- Enter the regular query data sending mailbox ", "log");
EmailData sh = new EmailData();
EmailData.SysEmailName = txtSysEmailName.Text;
EmailData.SysEmailPass = txtSysEmailPass.Text;
EmailData.UserEmailName = txtUserEmailName.Text;
EmailData.SysEmailTitle = txtSysEmailTitle.Text;
EmailData.SysExecuteTime = int.Parse(txtSysExecuteTime.Text);
DBHelper.OracleDBHelper.linkConn = this.txtOracleLjc.Text;
EmailData.OracleSql = txtOracleSql.Text;
EmailData.OracleField = txtOracleField.Text;
EmailData.OracleFieldDetail = txtOracleFieldDetail.Text;
SysFinalUtil.appLog = txtSysLog.Text+"log";
SysFinalUtil.appLog2 = txtSysLog.Text;
string color = "1";
string style = "1";
if (rbColor1.Checked) { color = "1"; }
else if (rbColor2.Checked) { color = "2"; }
else if (rbColor3.Checked) { color = "3"; }
if (rbStyle1.Checked) { style = "1"; }
else if (rbStyle2.Checked) { style = "2"; }
EmailData.SysColor = color;
EmailData.SysStyle = style;
glo2.GlobalValue2.Email_RecvHandle = new Thread(sh.Rev_RunEmail);
glo2.GlobalValue2.Email_RecvHandle.Start();
this.btnClose.Enabled = true;
this.btnStart.Enabled = false;
}
private void btnClose_Click(object sender, EventArgs e)
{
glo2.GlobalValue2.Email_RecvHandle.Abort();
this.btnStart.Enabled = true;
this.btnClose.Enabled = false;
WriteFileUtil.WriteFileLog("--------------------- Close the data thread ", "log");
}
#endregion
private void ToDataEmail_Load(object sender, EventArgs e)
{
if (glo2.GlobalValue2.Email_RecvHandle == null)
{
this.btnStart.Enabled = true;
this.btnClose.Enabled = false;
}
else
{
this.btnClose.Enabled = true;
this.btnStart.Enabled = false;
}
}
private void ToDataEmail_FormClosed(object sender, FormClosedEventArgs e)
{
this.WindowState = FormWindowState.Minimized;
this.Hide();
return;
}
private void ToDataEmail_FormClosing(object sender, FormClosingEventArgs e)
{
this.WindowState = FormWindowState.Minimized;
this.Hide();
e.Cancel = true;
return;
}
private void nfiLow_MouseDoubleClick(object sender, MouseEventArgs e)
{
this.Show();
//this.WindowState = System.Windows.Forms.FormWindowState.Maximized;
}
private void tsmixcSharp_Click(object sender, EventArgs e)
{
Process.Start("https://blog.csdn.net/weixin_43151418");
}
private void tsmiShow_Click(object sender, EventArgs e)
{
this.Show();
//this.WindowState = System.Windows.Forms.FormWindowState.Maximized;
}
private void tsmiVis_Click(object sender, EventArgs e)
{
this.Hide();
}
private void tsmiExit_Click(object sender, EventArgs e)
{
//WriteFileUtil.WriteFileLog("--------------------- Exit procedure ", "log");
nfiLow.Visible = false;
System.Environment.Exit(0);// All threads exit
this.Close();
this.Dispose();
System.Windows.Forms.Application.Exit();
}
private void timer1_Tick(object sender, EventArgs e)
{
this.txtMess.Text = WriteFileUtil.ReadTxt();
}
private void tsmiTxtLoad_Click(object sender, EventArgs e)
{
this.txtMess.Text = WriteFileUtil.ReadTxt();
}
private void tsmiTxtClear_Click(object sender, EventArgs e)
{
if (WriteFileUtil.clearTxt())
{
//MessageBox.Show(" Emptying complete !");
this.txtMess.Text = WriteFileUtil.ReadTxt();
}
else
{
MessageBox.Show(" Empty exception !");
this.txtMess.Text = WriteFileUtil.ReadTxt();
}
}
Run the file
double-click XcSharpApp.exe function
Source code address
【 Bloggers recommend 】C# Winform Send email regularly ( Source code attached )
边栏推荐
- [untitled]
- C语言标准的发展
- ++Implementation of I and i++
- Mysql27 - Optimisation des index et des requêtes
- MySQL33-多版本并发控制
- Global and Chinese markets of static transfer switches (STS) 2022-2028: Research Report on technology, participants, trends, market size and share
- Mysql22 logical architecture
- Unicode decodeerror: 'UTF-8' codec can't decode byte 0xd0 in position 0 successfully resolved
- Postman uses scripts to modify the values of environment variables
- MySQL21-用戶與權限管理
猜你喜欢
CSDN问答标签技能树(五) —— 云原生技能树
CSDN blog summary (I) -- a simple first edition implementation
MySQL33-多版本并发控制
解决:log4j:WARN Please initialize the log4j system properly.
Esp8266 at+cipstart= "", "", 8080 error closed ultimate solution
Pytorch RNN actual combat case_ MNIST handwriting font recognition
CSDN-NLP:基于技能树和弱监督学习的博文难度等级分类 (一)
保姆级手把手教你用C语言写三子棋
基于Pytorch的LSTM实战160万条评论情感分类
windows无法启动MYSQL服务(位于本地计算机)错误1067进程意外终止
随机推荐
Moteur de stockage mysql23
Mysql36 database backup and recovery
Discriminant model: a discriminant model creation framework log linear model
Valentine's Day is coming, are you still worried about eating dog food? Teach you to make a confession wall hand in hand. Express your love to the person you want
CSDN问答模块标题推荐任务(二) —— 效果优化
MySQL完全卸载(Windows、Mac、Linux)
Anaconda3 installation CV2
Postman environment variable settings
NPM an error NPM err code enoent NPM err syscall open
Pytorch RNN actual combat case_ MNIST handwriting font recognition
Mysql 其他主机无法连接本地数据库
windows下同时安装mysql5.5和mysql8.0
CSDN-NLP:基于技能树和弱监督学习的博文难度等级分类 (一)
Adaptive Bezier curve network for real-time end-to-end text recognition
Anaconda3 安装cv2
保姆级手把手教你用C语言写三子棋
MySQL34-其他数据库日志
解决扫描不到xml、yml、properties文件配置
1. Mx6u learning notes (VII): bare metal development (4) -- master frequency and clock configuration
【博主推荐】C#生成好看的二维码(附源码)