More email frustration

Discussion in 'ASP.NET 2.0' started by wmgraham, Sep 17, 2006.

  1. I have been unable to get my web application at Discount ASP to send mail. My primary goal is to allow users to get ne passwords when they forget their current one. For now, however, I made a very simple page to test sending mail at all.

    I have read a number of threads in the forum and followed all the advice I found. This includes:
    changing the <smtp><network host="localhost"/>
    and adding "Imports System.Net.Mail"
    and stopping and starting the server and recycling the application pool. Everything looks like it is working, but I get no email.

    Can anybody see anything I have overlooked (I don't know if there is someplace I have to set something up with DiscountASP to make DMTP work, and I have not done anything in that direction.

    The following are my applicable aspx, aspx.vb and config.web file content.

    Thanks in advance.

    SENDMAILEXAMPLE.aspx
    <%@ Page Language="VB" AutoEventWireup="false" CodeFile="SendMailExample.aspx.vb" Inherits="SendMailExample" %>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml" >
    <head runat="server">
    <title>Untitled Page</title>
    </head>


    <form id="form1" runat="server">
    <div align=center>
    &amp;nbsp;<asp:Button ID="Button1" runat="server" Text="MailSend Test" />
    </div>
    </form>
    </body>
    </html>

    SENDMAILEXAMPLE.aspx.vb
    Imports System.Net.Mail
    Partial Class SendMailExample
    Inherits System.Web.UI.Page
    Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click
    Dim mailServerName As String = "localhost"
    Dim message As MailMessage = New MailMessage("[email protected]", "[email protected]", "Test Mail", "This is the test body")
    Dim mailClient As SmtpClient = New SmtpClient
    mailClient.Host = mailServerName
    mailClient.Send(message)
    message.Dispose()
    End Sub
    End Class

    WEB.CONFIG
    ...
    <system.net>
    <mailSettings>
    <smtp>
    <network host="localhost"/>
    </smtp>
    </mailSettings>
    </system.net>
    ...
     
  2. Bruce

    Bruce DiscountASP.NET Staff

    Does it work when you send to other domains? like Yahoo?

    Bruce

    DiscountASP.NET
    www.DiscountASP.NET
     
  3. Just a clarification. The app behaves as though everything is OK, but I never receive an email (I changed the actual email addresses for the question. The actual addresses are valid Hotmail addresses.
     
  4. I triedYahoo and Comcast and it worked with both of them. Given the large number of useds that use Hotmail, however, I think it is important that I also be able to send to that domain (especially since my primary use will be to send people new passwords when they have forgotten theirs).

    Any ideas?
     
  5. I don't think the problem is with the code since I now seem to be able to send emails to many domains, but just not hotmail. Is anyone aware of anything hotmail is doing that might be causing the problem. Is anyone else successfully sendng email to hotmail domain from DiscountASP SMTP using system.net.mail?
     
  6. have you confirmed that sub is getting called?

    Try doing a Response.Write to see if that code is even being executed.


    Joel Thoms
    DiscountASP.NET
    http://www.DiscountASP.NET
     
  7. Bruce

    Bruce DiscountASP.NET Staff

    i've to agree with you the problem is not with the code. if the code fail, it should always throw some kind of exception


    Please create a support ticket and we can look into the mail log to see what happened to the email.


    Bruce

    DiscountASP.NET
    www.DiscountASP.NET
     
  8. I have narrowed it down to the point where I have tried 4 email addresses. Only the hotmail address does not work (and that isan email address that is used very frequently and which received numerous emails from other sources during this period). Comcast and Yahoo email addresses work fine. In all cases, I am using my same email domain name that I registered with DiscountASP as the send from email address. The only difference in my code is the actual send to email address.
     

Share This Page