locked
SMTP E-mail issues RRS feed

  • Question

  • User212556065 posted

    Got my e-mail working but still with some problems.

    It only works when I use the postmaster@localstar.com.au for "Your Email", see example http://www.localstar.com.au/ShowAd.aspx?id=75

    My host has advised the following but I am not sure of required modifications - any tips please!

    As "SMTP authentication" require the "Form address" to be the same as of the "email address" used in "authentication session", therefore, the page will only work if "Your email" field is set to "postmaster@localstar.com.au".

    Tuesday, September 30, 2008 7:27 AM

All replies

  • User-1760427068 posted

    I notice that your post hasn't received a reply.  I can't answer the original question you asked, but I was wondering if you might be interested in an alternative.

    If you have a gmail account and could use that for your work to send email from your web page, would that interest you? If I understand correctly, your main objective is to be able to send an email which, if someone replied to it, the reply would be sent to you, not the postmaster.

    -Larry

    Wednesday, November 12, 2008 9:00 AM
  • User212556065 posted

    This could work, can you explain method more.

     I have been told also that the problem is probably due to my IIS settings? - could this be true?

     Thanks for your help.

    R.

    Saturday, November 15, 2008 9:16 PM
  • User-1760427068 posted

    OK, I'll look for a post on this that I worked on a while back when working with someone else.  I'll post the link here and also try it myself, just in case anything has changed.

    I assume you are working with Visual Studio 2008 or Visual Web Developer 2008 Express Edition?

    Oh, and I need to know, do you use VB or C# for your code behind?

    -Larry

    Saturday, November 15, 2008 9:37 PM
  • User212556065 posted

    Thanks Larry, really appreciate it.

    I am using Visual Web Developer 2008 Express Edition

    Saturday, November 15, 2008 9:53 PM
  • User-1760427068 posted

     

    <%@ Page Language="VB" AutoEventWireup="false" CodeFile="VBMail_test2.aspx.vb" Inherits="VBMail_test2" %>
    
    <!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></title>
    </head>
    <body>
        <form id="form1" runat="server">
        
        <br />
        
        To: 
        <asp:TextBox ID="ToTextBox" Width="300px" runat="server" />
        
        <br /><br />
        
        Subject: 
        <asp:TextBox ID="SubjectTextBox" Width="500px" runat="server" />
        
        <br /><br />
        
        Message: 
        <asp:TextBox ID="MessageTextBox"  runat="server" Width="500px" Height="100px" TextMode="MultiLine" />
        
        <br /><br />
    
            <asp:Button ID="MailButton" runat="server" Text="Push to send the email" />
       
        </form>
    </body>
    </html>

     

    **********aspx code above *** aspx.vb code behind page below*************

     

    Imports System.Net.Mail
    
    Partial Class VBMail_test2
        Inherits System.Web.UI.Page
    
    
    
        Protected Sub MailButton_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles MailButton.Click
            Dim Mail As New System.Net.Mail.MailMessage()
            With Mail
                .To.Add(ToTextBox.Text)
                .From = New Net.Mail.MailAddress("youraccount@gmail.com")
                .Subject = SubjectTextBox.Text
                .Body = MessageTextBox.Text
            End With
            '
            Dim SMTP As New Net.Mail.SmtpClient("smtp.gmail.com")
            SMTP.Credentials = New System.Net.NetworkCredential("youraccount@gmail.com", "yourpassword")
            SMTP.Port = 587
            SMTP.Host = "smtp.gmail.com"
            SMTP.EnableSsl = True
            SMTP.Send(Mail)
            SMTP = Nothing
            Mail.Dispose()
            '
            ToTextBox.Text = ""
            SubjectTextBox.Text = ""
            MessageTextBox.Text = ""
    
        End Sub
    End Class

     

    *******code ends above this line************************

    The goal is for the above page and code behind page to successfully send an email. 

    I'm assuming you might also want to do this from an account on a server, possibly a web page.

    As an example, I have a web site on GoDaddy and when working with it I need to use a web.config file that is "dumbed down" to make it work with ASP.NET 2.0 version.

     -Larry

    Saturday, November 15, 2008 10:32 PM
  • User1519307918 posted

     

    Hi, I am wondering if you would provide the same for C#? Regards! Mohammad

    Wednesday, September 9, 2009 3:11 PM