Announcement

Collapse
No announcement yet.

Problem with Contact form email when no mail account setup

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Problem with Contact form email when no mail account setup

    Anyone using SmtpMail in ASP.Net to send a Contact form email?

    Following is an edited version of the code I'm using:

    Code:
    	<%@ Page Language="VB" %>
    	<%@ import Namespace="System.web.Mail" %>	
    	
    	'EMAIL CONTACT FORM
            Dim objMM As MailMessage
            objMM = New MailMessage
    
            objMM.From = "[email protected]"		'e.g. My Name <[email protected]>"
            objMM.To = "[email protected]"		'e.g. My alt email address
            objMM.Subject = "Contact Form"
            objMM.Body = "Test message"
    
            SmtpMail.SmtpServer = ""                'defaults to localhost
            SmtpMail.SmtpServer = "XXX.XXX.XXX.X"   'www.ip-adress.com/ip_tracer/ identifies this correctly as dnpwebhosting's mail server
            					'I ssume we shouldn't post the mail server IP here
    	SmtpMail.Send(objMM)
    This code was working, but recently I discovered it isn't now -- instead I get this error:

    "The server rejected one or more recipient addresses. The server response was: 550 <[email protected]> No such user here"

    I noticed that whatever 'To' or 'From' address I use, the error always references the 'To' address.

    I searched the forums and found:

    http://forums.eukhost.com/showthread...light=SmtpMail
    In this thread, Rock posted a sample ASP.Net Mailing script -- similar to mine -- but the 'To' and 'From' addresses are the same and it has an account on the server.

    http://forums.eukhost.com/showthread...light=SmtpMail
    In this thread, Rock said:
    localhost or the server's IP should be used for SmtpMail.SmtpServer.
    The server checks the existence of the address before sending the emails hence a valid Mail.From address should be supplied.
    you can provide your email address within the form for the From & To value, but make sure that it [email account] is present on the server.
    So what's different with my situation?

    I only use eUKHost for hosting my web site. My domain is managed by another company, who also manage my mail and forward it to my alt email address, so I don't need any mail accounts setup on the eUKHost server.

    The form email did work before -- don't know when it stopped working -- maybe eUKHost have tightened up on security.

    Does this mean I can't have Contact form data emailed to my external address?

    James

  • #2
    Oops! Sorry -- can a moderator please move my post above to the Windows Shared Hosting forum. Thanks

    Comment


    • #3
      Hello James,

      Apologies for late reply!

      Has the issue been resolved ?

      As you aren't using our email service i.e you are using external email server, you need to use the details of your external email server in your script.

      Code:
       SmtpMail.SmtpServer = "your external email servers IP"
      If your external email server requires authentication then you would need to use authentication as well.


      We have stopped the local smtp server that was used before for security reasons as it lead to spamming issues.
      Chris White
      (Former eUK Employee)


      UK's premier web hosting company.

      Comment


      • #4
        Thanks Chris,

        At least now I know the official reason why my Contact form stopped working.

        I changed the code to use the SmtpServer setting of my Alt email server, and it now works. It works because my Alt email server still provides access to the local smtp server, provided the 'To' address is the address for which I have an account there. If ever they disable the local smtp server (e.g. for spam reasons also), my Contact form will fail again.

        But there are two other cases where this issue would arise again (even if I were using eUKHosts to manage my email):

        (1) When a site user submits an enquiry, if I wanted to programatically send an acknowledgement email (not an auto responder email, but an email constructed within the ASP.Net code, and tailored to the enquirer), how is this possible, as the enquirer is unlikely to have an email account at my Alt email server (or at the eUKHost server)?

        (2) I'm also working on an Insurance Quotation System, whereby a site user can complete and submit a quote form. The user sees the resulting quote in a few seconds. I would like to allow the user request a copy of the quote be sent to his/her email address. Again, since eUKHost has stopped the local smtp server, how can I achieve that?

        James

        Comment


        • #5
          Hello James,


          Your code would require to have the SMTP server defined to your external mail server. All the email would be handled by the external mail server. We would not come into the picture as mail is not pointed to the server hosted with us.


          (1) When a site user submits an enquiry, if I wanted to programatically send an acknowledgement email (not an auto responder email, but an email constructed within the ASP.Net code, and tailored to the enquirer), how is this possible, as the enquirer is unlikely to have an email account at my Alt email server (or at the eUKHost server)?

          You can do it via code but again you would need to specify your SMTP Server to send out the email . You would need to use SMTP authentication and authenticate the email via your scripts. Some help for SMTP authentication can be found at http://support.microsoft.com/kb/555287

          (2) I'm also working on an Insurance Quotation System, whereby a site user can complete and submit a quote form. The user sees the resulting quote in a few seconds. I would like to allow the user request a copy of the quote be sent to his/her email address. Again, since eUKHost has stopped the local smtp server, how can I achieve that?

          You can define your SMTP server and its credentials here. Your SMTP server would not be an open relay and hence you with need to use SMTP authentication.

          Thanks,
          Ray

          Comment


          • #6
            Ray,

            Thanks for that info and the Microsoft article link.

            I haven't used authentication programatically in ASP.Net before, but the article includes an example. If I understand it correctly, in my code I need to authenticate myself to the remote smtp server, so that it can recognise me as someone with an emaill account there.

            Microsoft say: "Most of the SMTP servers installations requires authentication. The main reasoning for this is due to people abusing SMTP servers for SPAMing."

            So, if in the future, I used eUKHost to manage my email (instead of the current external mail server), and had an email account with eUKHost, would I then be able to use authentication with eUKHost's mail server to send an email to any user who submits a form on my web site?

            James

            Comment


            • #7
              Dear James,

              Correct if you use a valid email account and its hosted with us or anywhere you can send an email using SMTP authentication. You use the proper credentials you should be able to send out email using our SMTP server or your current SMTP server.

              Thanks,
              Ray

              Comment

              Working...
              X