Click here to Skip to main content
13,358,079 members (59,118 online)
Rate this:
Please Sign up or sign in to vote.
See more:
how to send mail everyday evening 7pm using c# code please send me the c# code
Posted 10-Sep-12 0:45am
Updated 10-Sep-12 2:44am
Wes Aday104.2K
Rate this: bad
Please Sign up or sign in to vote.

Solution 3


Quickest way to implement requested fynationality, You can write console application using C# which contain SMTP host and credential details in app.config file. class file will contain logic to send email as below :

using System;
using System.Collections.Generic;
using System.Text;
using System.Net.Mail;
using System.Net;

class Program
static void Main(string[] args)
Console.WriteLine("Mail To");
MailAddress to = new MailAddress(Console.ReadLine());

Console.WriteLine("Mail From");
MailAddress from = new MailAddress(Console.ReadLine());

MailMessage mail = new MailMessage(from, to);

mail.Subject = Console.ReadLine();

Console.WriteLine("Your Message");
mail.Body = Console.ReadLine();

SmtpClient smtp = new SmtpClient();
smtp.Host = "";
smtp.Port = 587;

smtp.Credentials = new NetworkCredential(
"", "password");
smtp.EnableSsl = true;
Console.WriteLine("Sending email...");

After creation of .EXE file, Please just schedule task using scheduler with Requested frequency.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy |
Web04 | 2.8.180111.1 | Last Updated 10 Sep 2012
Copyright © CodeProject, 1999-2018
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100