views:

63

answers:

4

In my web.config file there are below entries. It seems like it is used to send mails from my website.

How i know maiks has been sent from my website?

<add key="emailFromAddress" value="[email protected]"/>
<add key="emailTo_StoreAuthorise" value="[email protected]"/>
A: 

The mails are not sent through your website, but through your mail server.

Your options are:

  • Check the mail server to see if it logs your sent mails.
  • Add code to the method that sends the mail in your website to log this event in some place.
  • Maybe check some kind of IIS-log.
Seb Nilsson
A: 

Use such a code to generate link wich will set the mail's subject:

<asp:HyperLink id="EMailLink" runat="server"
NavigateUrl="mailto:<%# System.Configuration.ConfigurationSettings.AppSettings("emailFromAddress") %>?subject=[YourSite.com]"
>EmailUs</asp:HyperLink>
Veton
A: 

You can't know that mails have been sent from your web application. It is the responsibility of the mail server to process emails, not the web server - this means that your code will use mail code, which uses the mail server (e.g. exchange) to actually send out the mails.

What you could do, is check the mail server to see what's been sent out on this email address. It's not perfect, because you may have a user who sends mails on this account, so it will only tell you that mail was sent - not that this mail was sent by your code.

If you need this functionality, you'll need to write this information out at some point - e.g. when the code requests the send mail.

Pete OHanlon
A: 

I'm assuming you didn't write the app and have inherited it from someone else, but now wish to check that the email functionality is working and can't be bothered to look at the code?

If you are just trying to check that they work in a development setting and your app has a mailSettings config element, you could configure it so that the mails are written to disk, as shown here.

RichardOD