Please help!!! Send email problem.

Discussion in 'ASP.NET 2.0' started by firewire1981, Jul 19, 2007.

  1. Someone please help figure this out....

    I'm trying to send an email once a user registers...
    The code i am using is:

    Shared Function sendEmail(ByVal toEmail As String, ByVal fromEmail As String, ByVal subject As String, ByVal body As String) As String
    Dim smtpServer As String = "localhost"
    Try
    Dim sendFrom As New MailAddress(fromEmail)
    Dim sendTo As New MailAddress(toEmail)
    Dim myMessage As MailMessage = New MailMessage(sendFrom, sendTo)
    myMessage.Subject = subject
    myMessage.Body = body
    myMessage.IsBodyHtml = True
    Dim emailClient As New SmtpClient(smtpServer)
    emailClient.Send(myMessage)
    Return "True"
    Catch ex As Exception
    Return ex.Message
    End Try
    End Function</BLOCKQUOTE>
    I'm receiving an error that says "cannot get iis pickup directory"

    The discountasp techsupport replied with:

    "I'm not sure exactly how your web application is configured however you will need to go through your coding and insure that the application is pointing to 'e:\inetpub\mailroot\pickup' for the pickup folder."</BLOCKQUOTE>
    I have no idea what he's talking about... Where in my should I be configuring this?
     
  2. Bruce

    Bruce DiscountASP.NET Staff

    based on your code, you are not using the pickup directory.


    Is there an URL that generate the error?


    Bruce

    DiscountASP.NET
    www.DiscountASP.NET
     
  3. Yeah,there in no section of your code that could have caused this .You can explicitly specify Deliverymethod to 'SmtpDeliveryMethod.Network' and see if if this helps.

    i.e as per your code

    Dim emailClient As New SmtpClient(smtpServer)
    emailClient.DeliveryMethod = SmtpDeliveryMethod.Network</font>
    emailClient.Send(myMessage)

    Vikram

    DiscountASP.NET
    www.DiscountASP.NET
     
  4. GOT IT!!!


    vvsharmayou're a genius! [​IMG]


    thanks!
     

Share This Page