albertocolom / elmah

Automatically exported from code.google.com/p/elmah
Apache License 2.0
0 stars 0 forks source link

Support multiple email addresses with ErrorMailModule #10

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
To send the error reports to multiple email addresses, I made the 
following change:

In ErrorMailModule ReportError() method, locate this:
    mail.To.Add(new MailAddress(recipient));
and replace with this:
    string[] toAddresses = recipient.Split(';');
    foreach (string toAddress in toAddresses)
    {
        mail.To.Add(new MailAddress(toAddress));
    }

Now, you can put multiple addresses in the 'To' attribute of the errorMail 
setup like:
    <errorMail from="errors@mywebsite.com" to="email@hotmail.com; 
supportthis@hotmail.com" subject="Website Error" async="true"/>

Original issue reported on code.google.com by wayne.br...@gmail.com on 26 Jun 2007 at 3:58

GoogleCodeExporter commented 8 years ago
This is already supported but the synatx is different depending on the ELMAH 
compilation you use. If you are using ELMAH compiled for .NET Framework 1.x, 
then it 
relies on System.Web.Mail for SMTP support and where the recipient list has to 
be 
semi-colon-delimited (;) (see System.Web.Mail.MailMessage.To). If you are using 
ELMAH compiled for .NET Framework 2.0 or later, instead, then it relies on 
System.Net.Mail for SMTP support and where the recipient list has to be comma-
delimited (,) (see System.Net.Mail.MailAddressCollection.Add). Using semi-colon 
will 
actually throw FormatException. I know it's confusing, but the functionality is 
already there.

Original comment by azizatif on 26 Jun 2007 at 7:23

GoogleCodeExporter commented 8 years ago
I've added a comment in the sample web.config (see samples/web.config) about 
how to 
address multiple recipients in the error mail module configuration and 
hopefully 
this will help a bit for now. Eventually this may need to make into some sort 
of FAQ 
or documentation.

Original comment by azizatif on 26 Jun 2007 at 8:09

GoogleCodeExporter commented 8 years ago
Ok.  That is fine, just did not realize the comma would work under 2.0.
You could consider making it work with a comma under .net 1.1 and with a 
semicolon 
under .net 2.0 so that it just works under either platform, no faq, questions, 
problems, etc...

Original comment by wayne.br...@gmail.com on 26 Jun 2007 at 6:29

GoogleCodeExporter commented 8 years ago
Here is a patch that will allow semi-colons to work with 2.0 and comma to work 
with 1.1

Original comment by tbu...@gmail.com on 10 Dec 2007 at 8:37

Attachments:

GoogleCodeExporter commented 8 years ago
[deleted comment]
GoogleCodeExporter commented 8 years ago
[deleted comment]
GoogleCodeExporter commented 8 years ago
[deleted comment]
GoogleCodeExporter commented 8 years ago
[deleted comment]
GoogleCodeExporter commented 8 years ago
i ask the IT administrator in my company to create a distribution list to send 
emails
to many people at the same time , He create errorlog@mycompany.com using 
exchange
server when i use outlook to send emails to this address all the people listed 
in
this list receive my email, but when i use the same address with elmah 
configuration
section no email sent to anybody.

Original comment by TammamKo...@gmail.com on 14 Oct 2009 at 9:18

GoogleCodeExporter commented 8 years ago
Hi TammamKoujan, 

This seems like something for the ELMAH discussion group. Can you post this as 
a 
question there (http://groups.google.com/group/elmah) so that it can get the 
appropriate feedback please? 

Thanks,

James

Original comment by jamesdriscoll71 on 14 Oct 2009 at 12:47

GoogleCodeExporter commented 8 years ago
the dll is great but i m not able to dwonload the .net 3.5 version

Original comment by 2006bis...@gmail.com on 31 Mar 2011 at 4:12

GoogleCodeExporter commented 8 years ago
This issue has been migrated to:
https://github.com/elmah/Elmah/issues/10
The conversation continues there.
DO NOT post any further comments to the issue tracker on Google Code as it is 
shutting down.
You can also just subscribe to the issue on GitHub to receive notifications of 
any further development.

Original comment by azizatif on 25 Aug 2015 at 8:15