NewMailobj.Send gives me 500 INTERNAL ERROR

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Michael31277
    New Member
    • Dec 2008
    • 1

    NewMailobj.Send gives me 500 INTERNAL ERROR

    I keep getting this error on my form code, but only when I keep the MailNewObj.Send in the code, so I know it is this... I get the 500 INTERNAL ERROR message.. I tried shutting off "friendly messages" in IE, but it still winds up with the same message... I am publishing to GoDaddy and the GoDaddy server is ASP/LINUX since I wanted a combination of both... GoDaddy mentioned I should add the following lines, somewhere in my code:OUTGOING SERVER = relay-hosting.secures erver.net

    Any help would be appreciated...

    ENTIRE CODE:
    <%@ Language="VBscr ipt" %>
    <% Option Explicit %>

    <html>
    <head>
    <title>Messag e Sent</title>
    </head>

    <body>
    <%
    'declare the variables that will receive the values
    'receive the values sent from the form and assign them to variables
    'note that request.form("n ame") will receive the value entered into the textfield
    'called name, and so with email and message
    Dim first, last, phone, email
    Dim eventdate, eventtype, eventlocation, message, NewMailObj

    first=request.f orm("first")
    last=request.fo rm("last")
    phone=request.f orm("phone")
    email=request.f orm("email")
    eventdate=reque st.form("eventd ate")
    eventtype=reque st.form("eventt ype")
    eventlocation=r equest.form("ev entlocation")
    message=request .form("message" )

    'create the mail object and send the details
    Set NewMailObj=Serv er.CreateObject ("CDONTS.NewMai l")
    NewMailObj.From = "events@settevi deoproductions. com"
    NewMailObj.To = "events@settevi deoproductions. com"
    NewMailObj.Subj ect = "NEW MESSAGE FROM SETTEVIDEOPRODU CTIONS.COM"
    NewMailObj.Body = "First Name: " & first & _
    "<br>Last Name: " & last & _
    "<br>Phone: " & phone & _
    "<br>E-mail: " & email & _
    "<br>Event Date: " & eventdate & _
    "<br>Event Type: " & eventtype & _
    "<br>Event Location: " & eventlocation & _
    "<br>Messag e: " & message

    'you need to add the following lines FOR the mail to be sent in HTML format
    NewMailObj.Body Format = 0
    NewMailObj.Mail Format = 0
    'The next line gives me an error if I keep it in... it is necessary to send the mail out
    NewMailObj.Send

    'Close the email object and free up resources
    Set NewMailObj = nothing
    Response.Redire ct "http://www.settevideop roductions.com/thankyou.html"
    %>

    </body>
    </html>
  • CroCrew
    Recognized Expert Contributor
    • Jan 2008
    • 564

    #2
    Hello Michael31277,

    Try using this code in place of the code you pasted.

    Hope this helps,
    CroCrew~

    Code:
    <html>
    	<head>
    		<title>Message Sent</title>
    	</head>
    	<body>
    		<%
    			Function MailBody()
    				MailBody = "--- Information --" & vbCrLf
    				MailBody = MailBody & "First Name: " & 		Request.Form("first") & vbCrLf
    				MailBody = MailBody & "Last Name: " & 		Request.Form("last") & vbCrLf
    				MailBody = MailBody & "Phone: " & 			Request.Form("phone") & vbCrLf
    				MailBody = MailBody & "Email: " & 			Request.Form("email") & vbCrLf
    				MailBody = MailBody & "Event Date: " & 		Request.Form("eventdate") & vbCrLf
    				MailBody = MailBody & "Event Type: " & 		Request.Form("eventtype") & vbCrLf
    				MailBody = MailBody & "Event Location: " & 	Request.Form("eventlocation") & vbCrLf
    				MailBody = MailBody & "Message: " & 		Request.Form("message") & vbCrLf
    			End Function
    			
    		    Set myMail=CreateObject("CDO.Message") 
    		    myMail.Subject = "NEW MESSAGE FROM SETTEVIDEOPRODUCTIONS.COM" 
    		    myMail.From = "events@settevideoproductions.com" 
    		    myMail.To = "events@settevideoproductions.com" 
    		    myMail.TextBody = MailBody()
    		  
    		    On Error Resume Next  
    		       myMail.Send     
    		       If Err <> 0 Then  
    		          Response.Write("Error occurred: " & Err.Description) 
    		       else 
    		          Response.Write("Your message was sent successfully.") 
    				  Response.Redirect "http://www.settevideoproductions.com/thankyou.html"
    		       End If 
    		    Response.End 		
    		%>
    	</body>
    </html>

    Comment

    Working...