Please advise. I'm a newbie to ASP (but get along OK with PHP). Regardless, I need to use ASP to send an email to a person. The email is to contain the contents of a web form submitted. However, the email is never delivered. The webform can be found here http://www.seniorcitizensparty.org.uk/new.html and below is the ASP file (I've changed the Recipient to avoid spam.) Thanks in advance Mike <% @LANGUAGE="VBSCRIPT" CODEPAGE="1252"%> <html> <head> <title></title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> </head> <body> <% Set Mail = Server.CreateObject("SMTPsvg.Mailer") 'create an Asp mail component. Mail.FromName = "MEMBERSHIP APPLICATION/RENEWAL FORM" Mail.FromAddress= Request.Form("email") Mail.RemoteHost = "mrvnet.kundenserver.de" ' The mail server you have to use with Asp Mail Mail.AddRecipient "Welshmike" , "nospamplease@nospam.org.uk" Mail.Subject = "MEMBERSHIP APPLICATION/RENEWAL FORM" Mail.BodyText = Request.Form("title" & "firstname" & "lastname" & "titlep" & "firstnamep" & "lastnamep" & "address" & "address2" & "address3" & "telephone" & "telephonew" & "telephonem1" & "telephonem2" & "town" & "county" & "postcode" & "email" & "mp" & "con" & "council") if Mail.SendMail then Response.Write "Thank you. Details in your MEMBERSHIP APPLICATION/RENEWAL FORM have been sent to the Senior Citizens Party." else Response.Write "Sorry. Failure to send Details in your MEMBERSHIP APPLICATION/RENEWAL FORM to the Senior Citizens Party. The error was: " & Mail.Response end if Set Mail = Nothing %> </body> </html>
I dont see the information for the mail server and authentication details. Try this code: Sub sendmail(ByVal ToAddress As String, ByVal FromAddress As String, ByVal SubjectTag As String, ByVal BodyHTML As String, Optional ByVal bbcAddress As String = Nothing) Dim mail As New MailMessage() mail.To = ToAddress If Not String.IsNullOrEmpty(bbcAddress) Then mail.Bcc = bbcAddress End If mail.Subject = SubjectTag mail.BodyFormat = MailFormat.Html mail.From = FromAddress mail.Body = BodyHTML mail.Fields.Add("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate", "1") 'basic authentication mail.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendusername", "login@yourserver.com") 'set your username here mail.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendpassword", "yourpassword") 'set your password here SmtpMail.SmtpServer = "www.yourserver.com" 'your real server goes here or ip address Dim result As String Try SmtpMail.Send(mail) Catch ex As Exception result = ex.Message End Try end sub I tried to see the form, but the page is not loading.
hello, instead of using the component above, i prefer using the windows built in pickup service use this code: Set myMail=CreateObject("CDO.Message") myMail.Subject="your subject here" myMail.From="""your name here"" <xxx@xxx.com>" 'this must be your own email address myMail.To=xxx@hotmail.com ''' recipient address myMail.TextBody="body..................." myMail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/sendusing")=2 myMail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpserverpickupdirectory")="c:\Inetpub\mailroot\pickup" myMail.Configuration.Fields.Update myMail.Send set myMail=nothing