Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: C# ASP.NET
hi..
i write schedule email code. its working but i got multiple emails. how to remove this issue and how to send only one email..
 

 

Thanks in advance..
Posted 30-Nov-12 20:48pm
NaniCh709
Comments
Krunal R at 1-Dec-12 1:50am
   
Show your code..
OriginalGriff at 1-Dec-12 2:19am
   
Without your code, we can't help - it could be anything!
Use the "Improve question" widget to edit your question and provide better information.
NaniCh at 1-Dec-12 3:01am
   
i send the email through smtp servr. code exicute one time only.. but smtp server sends multiple emails
OriginalGriff at 1-Dec-12 3:08am
   
So there is a problem with your code somewhere - we can't see your screen, so you need to post the relevant code fragments.
Our only other option is to start guessing, and that is not a viable strategy in computing!
Use the "Improve question" widget to edit your question and provide better information or we can't help you!
Er. Vikas Sangal at 1-Dec-12 2:43am
   
check is there any loop for or foreach. post ur code
NaniCh at 1-Dec-12 3:01am
   
i send the email through smtp servr. code exicute one time only.. but smtp server sends multiple emails
Member 9492907 at 1-Dec-12 6:25am
   
can u paste ur code
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

Check for the time you have fixed for sending email.
 
and how many time it fires.
  Permalink  
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 2

hi dear,
 
try this code.
 
you are execute this code then email send one time and you are send multiple emails then use for loop.
 
private void MailSend()
    {
            try
            {
                MailMessage mail = new MailMessage();
                SmtpClient SmtpServer = new SmtpClient("smtp.gmail.com");  
                SmtpServer.Host = "smtp.gmail.com";
 
                mail.From = new MailAddress("FromMailName@gamil.com");
                mail.To.Add("ToMailName@gmail.com");
                mail.Subject = "Test Mail";
                mail.Body = "This is for testing SMTP mail from GMAIL";
 
                SmtpServer.Port = 587;
 
                SmtpServer.Credentials = new System.Net.NetworkCredential("ToMailName@gmail.com", "123456"); // User Mail Name And Mail Password
                SmtpServer.EnableSsl = true;
 
                SmtpServer.Send(mail);              
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }
        }
  Permalink  
Comments
NaniCh at 4-Dec-12 6:09am
   
now i am using same code. but get multiple emails. i didn't understand where this problem fire...
azizulhoque.bd at 4-Dec-12 6:18am
   
Please explain detail " get multiple emails. "
NaniCh at 6-Dec-12 0:13am
   
i write the code for scheduled emails through wcf services. i call the email service in global.asax file. in this i give the time interval 60sec so my code is running every 60 sec. i get the scheduled emails time from StoredProcedure. so when the time is matched for scheduled time and current time service can be called. my loop repeats only one time but mails sends multiple times. i didn't understand what happens.. can you help me.. THanks in advance
shaikh-adil at 12-Dec-12 0:06am
   
+5

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

  Print Answers RSS
0 OriginalGriff 240
1 Kamal Rocks 184
2 PIEBALDconsult 150
3 BillWoodruff 148
4 Jochen Arndt 135
0 OriginalGriff 5,695
1 DamithSL 4,506
2 Maciej Los 4,007
3 Kornfeld Eliyahu Peter 3,480
4 Sergey Alexandrovich Kryukov 3,190


Advertise | Privacy | Mobile
Web02 | 2.8.141216.1 | Last Updated 4 Dec 2012
Copyright © CodeProject, 1999-2014
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