Click to See Complete Forum and Search --> : Rediculous email code error


Calmaris
02-19-2004, 04:28 PM
I'm getting an error saying I need to declare objMM. This is driving me nuts.

<%@ Page Explicit="True" Language="VB" Debug="true" %>
<%@ import Namespace="System.IO" %>
<%@ import Namespace="System.Web.Mail" %>
<script runat= "Server">

Dim Hunt_Email = request.form("Hunt_Email")
Dim Hunt_First_Name = request.form("Hunt_First_Name")
Dim theBody = request.form("thebody")

Dim objMM As New MailMessage
objMM.To = ""& Hunt_Email &""
objMM.From = "NorthshoreAdventures@sympatico.com"
objMM.Cc = ""& Hunt_Email &""
' Set style as HTML.
objMM.BodyFormat = MailFormat.Text
objMM.Subject = "You have registered"
objMM.Body = thebody = "Your our newest hunter"
thebody = thebody & "Congradulations "& Hunt_First_Name &" you have just registered to Northshore " & _
" Adventures, the ultimate site for you hunting needs. "
thebody = thebody & "If you have any questions plz email us at northshoreadventures@sympatico.com " & _
" if link is broken email Alex at Calmaris@hotmail.com "

SmtpMail.Send(objMM)
</script>

Ribeyed
02-19-2004, 05:47 PM
Hi,
sorry don't know much ASP.NET and this might not fix your problem, however this following line looks wrong to me:


objMM.Body = thebody = "Your our newest hunter"
thebody = thebody & "Congradulations "& Hunt_First_Name &" you have just registered to Northshore " & _
" Adventures, the ultimate site for you hunting needs. "


mayeb should look like this:



thebody = "Your our newest hunter"
thebody = thebody & "Congradulations "& Hunt_First_Name &" you have just registered to Northshore " & _
" Adventures, the ultimate site for you hunting needs. "


objMM.Body = thebody

buntine
02-20-2004, 01:28 AM
SmtpMail


Did you set that as an object?

Calmaris
02-20-2004, 08:00 AM
I'm getting an error declaration expected, for objMM.TO, objMM.From actuall all the objmm... I tried putting Dim in front of them all and at then end I end up with another error.

<%@ Page Explicit="True" Language="VB" Debug="true" %>
<%@ import Namespace="System.IO" %>
<%@ import Namespace="System.Web.Mail" %>

'--------------------request the form elements and write to variables----------------------

<script runat= "Server">


Dim Hunt_Email = request.form("Hunt_Email")
Dim Hunt_First_Name = request.form("Hunt_First_Name")
Dim theBody = request.form("thebody")


Dim objMM As New MailMessage
objMM.To = ""& Hunt_Email &""
objMM.From = "NorthshoreAdventures@sympatico.com"
objMM.Cc = ""& Hunt_Email &""
' Set style as HTML.
objMM.BodyFormat = MailFormat.Text
objMM.Subject = "You have registered"
objMM.Body = thebody
thebody = thebody & "Congradulations "& Hunt_First_Name &" you have just registered to Northshore " & _
" Adventures, the ultimate site for you hunting needs. "
thebody = thebody & "If you have any questions plz email us at northshoreadventures@sympatico.com " & _
" if link is broken email Alex at Calmaris@hotmail.com "

SmtpMail.Send(objMM)
</script>

buntine
02-20-2004, 08:30 AM
Does your server have an active SMTP server setup? Secondly, dont you have to tell the script what the address of the SMTP server is?

Calmaris
02-20-2004, 08:36 AM
This site is being hosted by Brinkster I'm looking into it right now. I'm regretting my decision to host this site there....

buntine
02-20-2004, 08:46 AM
Stop trying.. You will find it extremely difficult to find a free host which will allow you to use their SMTP server.

I know that Brinkster definetely wont allow you to.

Calmaris
02-20-2004, 09:08 AM
Ok I'm trying something different. The CDONTSm has changed to CDOSYS and I'm gettting this error now!!!
Line 33 is the error. Do I have to make it an object? How do I do that?
Exception Details: System.Web.HttpException: Could not create an object of type 'CDOSYS.NewMail'.

Source Error:


Line 31: '-------------------setup the CDONTS email object-------------------------------------
Line 32: Mailer = Server.CreateObject("SMTPsvg.Mailer")
Line 33: ObjMail = Server.CreateObject("CDOSYS.NewMail")
Line 34: '------------------------Set the email elements------------------------------
Line 35: Mailer.To '"& Hunt_Email &"'





'-------------------setup the CDONTS email object-------------------------------------
Mailer = Server.CreateObject("SMTPsvg.Mailer")
ObjMail = Server.CreateObject("CDOSYS.NewMail")
'------------------------Set the email elements------------------------------
Mailer.To '"& Hunt_Email &"'
Mailer.CC = ""& Hunt_Email &""
Mailer.From = "NorthshoreAdventures@sympatico.com"
Mailer.Subject = "You have registered"
thebody = "Your our newest hunter" & vbcrlf
'----------------create the body of the message------------------------
thebody = thebody & "Congradulations "& Hunt_First_Name &" you have just registered to Northshore " & _
" Adventures, the ultimate site for you hunting needs. "
thebody = thebody & "If you have any questions plz email us at northshoreadventures@sympatico.com " & _
" if link is broken email Alex at Calmaris@hotmail.com "
Mailer.Body = thebody
'----------------------send the message-----------------------------------
Mailer.Send
Mailer = Nothing

buntine
02-20-2004, 09:30 AM
Brinkster dont allow your to use email of any type.

Calmaris
02-20-2004, 09:37 AM
It did before they applied the new microfoft patch and it worked fine! Is there anything wrong with my code?

Calmaris
02-21-2004, 09:25 PM
So how can I just send the mails without having to connect to a mail server??? I don't think I had to before

PeOfEo
02-21-2004, 09:36 PM
ditch brinkster. http://europe.webmatrixhosting.net is free, has no ads, has uncapped bandwidth, ftp, mssql server, on w2k3, and yes it does give its users smtp access. Brinkster does not allow it to anyone but the premium users to my knowledge.

Calmaris
02-23-2004, 07:16 AM
Ok What I don't understand is why I could do it before and not now. Brinkster installed the .net 1.1 CDONTS changed to ASPMAIL or/and CDOSYS now I can't send mail. Before I didn't have to have a line of code connecting to a mail server it just sent the emails, I'm not understanding this all.

PeOfEo
02-23-2004, 07:17 PM
Originally posted by Calmaris
Ok What I don't understand is why I could do it before and not now. Brinkster installed the .net 1.1 CDONTS changed to ASPMAIL or/and CDOSYS now I can't send mail. Before I didn't have to have a line of code connecting to a mail server it just sent the emails, I'm not understanding this all. When I used brinkster I could not use the smtp at all because I was on a general account. I paid for it for about a month but got fed up with the horrible errors caused by their setup (webfarm problems) and I was pissed because I could not use code behinds, global files, or smtp.