Showing posts with label emails. Show all posts
Showing posts with label emails. Show all posts

Wednesday, March 28, 2012

The best way to send a large number of emails

I have around 100,000 email addresses I want to send an email to each of this customer.
What is the best way to send emails to these customers?

I appreciate any idea,suggestion or comment.

Thank youHello, maybe you can have a script that creates a datareader out of all the emails in ur database, and then you can make one field of the email which is the "To" and concate all the emails u have seperating them with either ";" or "," and then send that email, which will go to many many emails u have !!!!!
Well the problem with that is how do you set the timeout value? How long is that going to take - 5 minutes or an hour or 3 hours to send 100,000 e-mails? Your asp.net page will time out if you don't set the timeout value extremely high.

I think he knows "how" to send e-mails, but wants to know what approach to use when sending volumes of email. And also, you don't want to put all the names in the TO field, you'd want to use BCC.
Hi,
For both of you here is how to set server time out:

The following example sets the request time-out period to 60 seconds.

[Visual Basic]
Server.ScriptTimeout = 60

[C#]
Server.ScriptTimeout = 60;

[C++]
Server->ScriptTimeout = 60;

[JScript]
Server.ScriptTimeout = 60
you can place it anywhere i ur page_load method.

good luck
You might want to make this a desktop app or a service instead. I would go with a desktop app, as you can create a simple GUI that will at least give you feedback as to at which section your code is at so that you know it's working. Then you don't need to set any kind of timeout. Just start it up before you go to bed and it should be done by morning.

Is there any logical way you can "chunk" the data? Don't forget that DataSets are stored in memory and DataReaders stay connected while you spin through them.

Thursday, March 22, 2012

The given paths format is not supported??

Can anyone explain to me why this works...

string Email_Loc; //Stores the emails full path.
TextReader Msg_Reader = File.OpenText(Email_Loc);
Email_Msg = Msg_Reader.ReadLine();
Msg_Reader.Close();

but this
string Email_Loc; //Stores the emails full path.
TextReader Msg_Reader = File.OpenText(Email_Loc);
Email_Msg = Msg_Reader.ReadToEnd();
Msg_Reader.Close();
or this does not??

string Email_Loc = ""; //Stores the emails full path.
TextReader Msg_Reader = File.OpenText(Email_Loc);
while(Msg_Reader.ReadLine() != null)
{
Email_Msg += Msg_Reader.ReadLine();
}
Msg_Reader.Close();
I need to be able to read the entire file but when I try ether of the second two code blocks I get the following error.
System.NotSupportedException: The given path's format is not supported.
at System.Security.Util.StringExpressionSet.CanonicalizePath(String path, Boolean needFullPath)
at System.Security.Util.StringExpressionSet.AddExpressions(String[] str, Boolean checkForDuplicates, Boolean needFullPath)
at System.Security.Permissions.FileIOPermission.AddPathList(FileIOPermissionAccess access, String[] pathListOrig, Boolean checkForDuplicates, Boolean needFullPath, Boolean copyPathList)
at System.Security.Permissions.FileIOPermission..ctor(FileIOPermissionAccess access, String[] pathList, Boolean checkForDuplicates, Boolean needFullPath)
at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, Boolean useAsync, String msgPath, Boolean bFromProxy)
at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize)
at System.IO.StreamWriter.CreateFile(String path, Boolean append)
at System.IO.StreamWriter..ctor(String path, Boolean append, Encoding encoding, Int32 bufferSize)
at System.IO.StreamWriter..ctor(String path)
at SpamCenturion.MainClass.scanMessage(String Current_Msg, String Msg_Path)Where does Email_Loc get set? It does not appear to be set correctly in any of your examples.

Thanks for the replyDouglas.
I'm actually setting it higher up, but fortunately I figured out that it was just a simple oversight on my part.
A few lines further down I'm calling a method that actually wrote back to the file.
The only problem was that I was passing the file path to it twice.
And so the error "The given path's format is not supported".
I hadn't made it that far down in my debugging because it seemed that the code was failing at this point.
Sorry to waste your time.
Thanks again for the quick response.