|
Hi, I posted the following mesage to a wrong forum earlier. Hope you can forgive me. Here is the re-post:
I tried to find an answer for while but could not get one. Here is the code to send ONE email:
MailMessage mail = new MailMessage();
mail.From = SenderEmail;
mail.To = RecipientEmail;
mail.Subject = "My Subject";
mail.Body = "My Message";
SmtpMail.SmtpServer = "MyServer";
SmtpMail.Send(mail);
mail=null;
However, if you want to send the email to thousands of each individual email address, do you place the loop outside of this code block or inside?
if outside, the mail object is created and destroyed in every loop:
for (int i=0;i<10000;i++)
{
RecipientEmail=GetEmail(i);//retrieve an email address
MailMessage mail = new MailMessage();
mail.From = SenderEmail;
mail.To = RecipientEmail;
mail.Subject = "My Subject";
mail.Body = "My Message";
SmtpMail.SmtpServer = "MyServer";
SmtpMail.Send(mail);
mail=null;
}
if inside, the mail object is created once:
MailMessage mail = new MailMessage();
for (int i=0;i<10000;i++)
{
RecipientEmail=GetEmail(i);//retrieve an email address
mail.From = SenderEmail;
mail.To = RecipientEmail;
mail.Subject = "My Subject";
mail.Body = "My Message";
SmtpMail.SmtpServer = "MyServer";
SmtpMail.Send(mail);
}
mail=null;
Which is the proper way or does not really matter?
Thanks,
TOMZ_KV
|
|
|
|
|
I feel i've seen this before...
Why not try:
MailMessage mail = new MailMessage();
mail.From = SenderEmail;
mail.Subject = "My Subject";
mail.Body = "My Message";
SmtpMail.SmtpServer = "MyServer";
for (int i=0;i<10000;i++)
{
RecipientEmail=GetEmail(i);//retrieve an email address
mail.To = RecipientEmail;
SmtpMail.Send(mail);
}
mail=null;
Assuming that the subject, message, and server all stay the same.
My current favourite word is: Waffle
Cheese is still good though.
|
|
|
|
|
|
May be its a website with thousands of members...
I just supported spam e-mails didn't I?
My current favourite word is: Waffle
Cheese is still good though.
|
|
|
|
|
The Undefeated wrote: I just supported spam e-mails didn't I?
Yeah, I think you did.
I get all the news I need from the weather report - Paul Simon (from "The Only Living Boy in New York")
|
|
|
|
|
Generally, you should put as many recipients as you can into the same message so that servers can make use of single-instance storage and reduce the amount of traffic sent. The SMTP specification (RFC 2821[^]) requires that SMTP servers accept at least 100 recipients per message. However, some sites now only accept lower limits (notably Hotmail). Intermediate servers can generally cope with splitting a message where there are too many recipients at a receiving site. A SMTP server set up to deliver mail on your behalf - often called a 'smart host' - will perform separate SMTP connections to each receiving site, if there is more than one receiving domain in the recipient list.
If you don't want the recipients to see the list of users that the message was sent to, use the Bcc field.
The System.Web.Mail namespace wraps the CDOSYS library. I think it's OK to add as many addresses as you like in a single message up to the limit configured in the SMTP server you send to, which will in turn split the message into multiple messages as required for each server it talks to, if that server's recipient limit is reached. You'll have to find out the limit from the administrator of your server.
System.Net.Mail classes (e.g. SmtpClient) do the SMTP conversation directly in .NET code if you set DeliveryMethod to SmtpDeliveryMethod.Network (saving a heck of a lot of COM Interop chatter). In this case, if you specify more addresses than the receiving server can handle, you will get an SmtpFailedRecipientException (if only one failed) or an SmtpFailedRecipientsException (more than one). Cases where it failed because too many recipients were specified should appear with a StatusCode of SmtpStatusCode.InsufficientStorage (452), but might appear as ExceededStorageAllocation (552).
DoEvents : Generating unexpected recursion since 1991
|
|
|
|
|
i am trying to create an activex control using C# that allow me to drag and drop items from desktop on it for file upload ,but i'm having a problem, i can't register the control ,if anyone can help me register the activex control using c# code ,plzzzz help
thanks.
Maya
|
|
|
|
|
for those who brilliant in C#..please help me wit tis program?
Create a simple calculator using overloading operator?how to create simple arithmetic operation wit addition,subtraction,multiplication and division...
Using array n structure,create a calendar frm the month of JAN until DEC
user enter any month, the number of days should be display according to the month typed-in
please i need help..i'm not lie..i need it for my project,any ideas of method tat u alls can help me..
-- modified at 7:49 Wednesday 24th October, 2007
|
|
|
|
|
<blockquote class="FQ"><div class="FQA">Mohd. Firdaus wrote:</div>please i need help..i'm not lie..i need it for my project,any ideas of method tat u alls can help me.</blockquote>
Well done for telling the truth, but im afraid I dont think anyone will complete your homework for you.
However, we're happy to help - you just need to show us that you've at least made an attempt yourself and have a specific coding problem. When you do, post the code along with a description of the issue you are having and we'll do our best to guide you.
Good luck... get coding.
---
How to get answers to your questions[^]
|
|
|
|
|
Read a good book about (C#) programming.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
|
|
|
|
|
my dear student mr. Mohammad Firdaus!
this is Professor Ulhas from university. I tell my students including u specifically that you must no post homowork on the codeprojectiles. now i'm witnessing with my own eternally saddened eyes u ignorning my warnings and dismissings my cumings, u posted homosexworks on the code projectians!
u eternally sadden me with deep melancholy. curses of shiva on you! black grade now and forever. expel u from university! i want to tear my eyes out and squish them under foot becuz u made me so saddened with ur posting homoworks on the cepian web sight. no more sensual favors for u. u will be exorcised and expelled u devil!
Sincelery yours, Computer Information conSciences Professor and grader, Sharada Ulhas
|
|
|
|
|
This was marginally funny the first time you did it - now you're just trolling.
|
|
|
|
|
hello please lah wei...be practical?i just ask help or guide ok not to ask the whole things?i am in begineer stage of cuz need help..dun simply judge ppl lah...if ur are the professor be moderate okeh?if dun wan help just say cannot help...if not just guide me..thanks for urs reply coollzzzz
|
|
|
|
|
Hi,
I want to drop text to a textbox via drag'n'drop.
basic drag'n'dropping is no problem but I want to insert the text at a specific cursor position, that changes with the mouse cursor like selecting text in MS Word and moving it around an drop it between other text passages...
Is this generally possible and how?
greetings
|
|
|
|
|
I dunno for sure.. but you can try this.
Make a MouseDrag event on the textbox and in the event move the cursor to the position of the mouse.
When you release.. Fire the DragNDrop event.
I hope it helps
------------------------------------------------------------------
Life would have been much easier if I had the source-code!!
|
|
|
|
|
thank you I'll try this asap
|
|
|
|
|
if i have a List<> of controls. i can add those controls to a container
and use the .Parent property. but is there any way to find out which List<> ('s) the control belongs to?
i know i can do it the other way with .Contains on the list but then i would need a list of lists to enumerate.
Am i missing something obvious here?
If it' stuck, DO NOT pull harder!
|
|
|
|
|
Hi,
this is how I see it:
- a Control can be shown in some Container, and Parent will reflect that;
there is only one Parent, since the Control is in one Container at most.
- an object (Control or other) can be part of many collections at the same time;
so there is no property that points from that object to the collection(s) it is in.
- if you somehow make sure an object is in exactly one of several collections, you can
reflect that fact in several ways, here are two of them:
(a) create a Hashtable or Dictionary, use the object/Control as key, and the collection
it belongs to as value; doing so, a single Hashtable/Dictionary lookup will return the
collection
(b) a Control has a Tag property that is not used by Windows or the .NET Framework;
it has type Object and can be used for whatever purpose you see fit. So you could store
a reference to the collection in that Tag.
Three more comments:
1. in both cases you would have to provide code to keep things correct (insert/replace
the Hashtable/Dictionary entry when the Control is inserted into or mode among collections
2. when using the Tag property or the Hashtable you would need to cast the value
to a Control (or a more specialized type such as Label) when you retrieve it.
3. The proposed ways avoid the explicit search at the expence of extra data; this data
redundancy could result in an inconsistent state. If you don't like that, the solution is
to search the collections, as you were mentioning.
Luc Pattyn [Forum Guidelines] [My Articles]
this months tips:
- use PRE tags to preserve formatting when showing multi-line code snippets
- before you ask a question here, search CodeProject, then Google
|
|
|
|
|
Thanks for the reply.
this is just one of those "i wonder what the best way to solve X is" thaughts that just wont leave my brain ;}
i had a project a couple of weeks ago where i needed to have a reference to the "parent list" which i solved by overloading the controls and adding a ParentList property. but that never felt like "best practice". i needed the .Tag for other purposes
CP should have a Philosophy message type ;}
If it' stuck, DO NOT pull harder!
|
|
|
|
|
c0ax_lx wrote: CP should have a Philosophy message type ;}
Actually, this would fit quite nicely into the Design and Architecture section. It would certainly trigger a debate.
Deja View - the feeling that you've seen this post before.
|
|
|
|
|
probably! i just need to gather some courage. i'm scared of professional software architects ;}
If it' stuck, DO NOT pull harder!
|
|
|
|
|
Don't be. Most of the people who answer on that forum are professional developers rather than architects.
Deja View - the feeling that you've seen this post before.
|
|
|
|
|
I want to attach a file to my c# project while clicking the browse button,using open file dialogue we can open the file but i want to save it in a particular folder in tha solution explorer
bobin
|
|
|
|
|
File.Copy(source,target) (System.IO namespace)
you'd have to extract the filename from source, and append it to the target path. then save the target path somewhere in your app.
If it' stuck, DO NOT pull harder!
|
|
|
|
|
hi,
As there is no provision for saving the address of the background image of a form or a picturebox when the image is loaded using a property grid i was suggested to override the propertygrid and to write a event for the same
so i have overriden the function now i dont know what type of overriding function must be written so as to store the image address if any one knows please let me know as i am strucked at this point
regards
sindhu tiwari
thank u codeproject.com
|
|
|
|