More in this section

Forums / Developing with Sitefinity / sending emails from sitefinity

sending emails from sitefinity

2 posts, 0 answered
  1. Laura
    Laura avatar
    311 posts
    Registered:
    25 Feb 2008
    13 Nov 2009
    Link to this post
    Hi - I am trying to send an email after a person registers.  I am not using the CreateNewUserWizard however but the code from this link: http://www.sitefinity.com/support/code-library/sitefnity/userandcustomcontrols/set-of-user-management-controls-by-sam-grimmer.aspx

    When sending the email, I get an Access is denied error:
    ASP.NET is not authorized to access the requested resource. Consider granting access rights to the resource to the ASP.NET request identity. ASP.NET has a base process identity (typically {MACHINE}\ASPNET on IIS 5 or Network Service on IIS 6) that is used if the application is not impersonating. If the application is impersonating via <identity impersonate="true"/>, the identity will be the anonymous user (typically IUSR_MACHINENAME) or the authenticated request user.

    My question is this: The PasswordRecoveryControl is able to send out an email to the user with a temporary password. What / how is it sending the email and why does it not get an access deinied error.
    How can I simply send an email notification to the user (or Subscribe for SendingMail event) if I am not using the CreateUserWizard control?

    The newsletter is having the same issue with sending.  Is it just a matter of my server settings?

    Thank you in advance.
  2. Laura
    Laura avatar
    311 posts
    Registered:
    25 Feb 2008
    13 Nov 2009
    Link to this post
    Yay - I got it to work...

    used   using System.Net.Mail;
    instead of using System.Web.Mail;

    MailAddress from = new MailAddress("fromaddress@email.com", "from name");
    MailAddress to = new MailAddress("toaddress@email.com", "to name");
    MailMessage message = new MailMessage(from, to);
    message.Subject =
    "Using the SmtpClient class.";message.Body = "Using this feature, you can send an e-mail message from an application very easily."
    SmtpClient smtpClient = new SmtpClient();
     
    smtpClient.Send(message);

     

     

     

     

     

     

2 posts, 0 answered