Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support multiple email addresses with ErrorMailModule #10

Open
atifaziz opened this issue Aug 25, 2015 · 7 comments
Open

Support multiple email addresses with ErrorMailModule #10

atifaziz opened this issue Aug 25, 2015 · 7 comments

Comments

@atifaziz
Copy link
Member

Originally reported on Google Code with ID 10

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="[email protected]" to="[email protected]; 
[email protected]" subject="Website Error" async="true"/>


Reported by wayne.brantley on 2007-06-26 03:58:06

@atifaziz
Copy link
Member Author

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.

Reported by azizatif on 2007-06-26 07:23:03

  • Labels added: Type-Enhancement
  • Labels removed: Type-Defect

@atifaziz
Copy link
Member Author

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.

Reported by azizatif on 2007-06-26 08:09:21

  • Status changed: Started
  • Labels added: Component-Docs

@atifaziz
Copy link
Member Author

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...

Reported by wayne.brantley on 2007-06-26 18:29:45

@atifaziz
Copy link
Member Author

Here is a patch that will allow semi-colons to work with 2.0 and comma to work with
1.1

Reported by tbunce on 2007-12-10 20:37:43


- _Attachment: [elmah_mutipleemail.patch](https://storage.googleapis.com/google-code-attachments/elmah/issue-10/comment-4/elmah_mutipleemail.patch)_

@atifaziz
Copy link
Member Author

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 [email protected] 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.

Reported by TammamKoujan on 2009-10-14 09:18:13

@atifaziz
Copy link
Member Author

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

Reported by jamesdriscoll71 on 2009-10-14 12:47:11

@atifaziz
Copy link
Member Author

the dll is great but i m not able to dwonload the .net 3.5 version

Reported by 2006biswas on 2011-03-31 16:12:28

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant