calypsoworld
asked on
Send asynchronous email in website
Hi!
I have some tasks in my website that sends emails.
The problem is that the email sending may be slow, forcing the user to be waiting, sometimes, too much.
How can I do something that do all the stuff and sends the email in background, without disturbing the normal system process.
Maybe using Asynchronous method to send email... I don't know.
I've tried this tutorial <http://www.asp.net/general/videos/how-do-i-send-email-asynchronously-with-aspnet> but it didn't worked. Actually, I'm not sure if it's what I need.
Thanks in advance!
I have some tasks in my website that sends emails.
The problem is that the email sending may be slow, forcing the user to be waiting, sometimes, too much.
How can I do something that do all the stuff and sends the email in background, without disturbing the normal system process.
Maybe using Asynchronous method to send email... I don't know.
I've tried this tutorial <http://www.asp.net/general/videos/how-do-i-send-email-asynchronously-with-aspnet> but it didn't worked. Actually, I'm not sure if it's what I need.
Thanks in advance!
ASKER
Thank you for reply!
I can't make this code work in C#, even changing the AddressOf to new EventHandler...
I can't make this code work in C#, even changing the AddressOf to new EventHandler...
public void SendEmailInSeparateThread( )
{
try {
t = new Thread(this.SendEmail);
t.Start();
} catch (Exception ex) {
}
}
{
try {
t = new Thread(this.SendEmail);
t.Start();
} catch (Exception ex) {
}
}
ASKER
public void SendEmailInSeparateThread( )
{
System.Threading.Thread t;
try {
t = new Thread(this.SendEmail(para m1, param2);
t.Start();
} catch (Exception ex) {
}
}
ERROR:
Error 6 The best overloaded method match for 'System.Threading.Thread.T hread(Syst em.Threadi ng.Paramet erizedThre adStart)' has some invalid arguments
{
System.Threading.Thread t;
try {
t = new Thread(this.SendEmail(para
t.Start();
} catch (Exception ex) {
}
}
ERROR:
Error 6 The best overloaded method match for 'System.Threading.Thread.T
Why are you sending Parameters? for that use this
public void SendEmailInSeparateThread( )
{
System.Threading.Thread t;
try {
t = new Thread(new ParameterizedThreadStart(S endEmail)) ;
t.Start(Param1,Param2);
} catch (Exception ex) {
}
}
public void SendEmailInSeparateThread(
{
System.Threading.Thread t;
try {
t = new Thread(new ParameterizedThreadStart(S
t.Start(Param1,Param2);
} catch (Exception ex) {
}
}
ASKER
Still not working... Method sendEMailContactForm has 4 arguments, all String
Thread t;
Error 5 t = new Thread(new ParameterizedThreadStart(t his.sendEm ailContact Form));
Error 6 t.Start("ok","ok","ok","ok ");
Error 5 No overload for 'sendEmailContactForm' matches delegate 'System.Threading.Paramete rizedThrea dStart'
Error 6 No overload for method 'Start' takes 4 arguments
Thread t;
Error 5 t = new Thread(new ParameterizedThreadStart(t
Error 6 t.Start("ok","ok","ok","ok
Error 5 No overload for 'sendEmailContactForm' matches delegate 'System.Threading.Paramete
Error 6 No overload for method 'Start' takes 4 arguments
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
sorry for thr C# - VB mixing
ASKER
OK.
I'll try this solution.
Thank you!
I'll try this solution.
Thank you!
Public Sub SendEmailInSeparateThread(
Try
t = New Thread(AddressOf Me.SendEmail)
t.Start()
Catch ex As Exception
End Try
End Sub