Click to See Complete Forum and Search --> : translate from asp.net to asp
esthera
12-05-2004, 05:17 AM
Can I do this function in asp? (using this mail component the server does not have cdonts)
Sub SendMail(ByVal mail_text As String)
Dim objEmail As New MailMessage()
objEmail.To = SendTo
objEmail.From = sendFrom
'objEmail.Cc = txtCc.Text
objEmail.Subject = "ORDER"
objEmail.Body = mail_text
objEmail.Priority = MailPriority.High
SmtpMail.SmtpServer = "myserver.local"
Try
SmtpMail.Send(objEmail)
'Response.Write(Your E-mail has been sent sucessfully - Thank You)
Catch exc As Exception
Response.Write("Send failure: " + exc.ToString())
End Try
End Sub
russell
12-05-2004, 07:19 PM
Yes. The following example uses cdonts. You could also use cdo, or any number of third party products.
Sub SendMail(ByVal mail_text As String)
Dim objEmail
Set objEmail = Server.CreateObject("CDONTS.NewMail")
objEmail.To = SendTo
objEmail.From = sendFrom
objEmail.Subject = "ORDER"
objEmail.Body = mail_text
objEmail.Priority = MailPriority.High
On Error Resume Next
objEmail.Send
If Err.Number <> 0 Then
Response.Write "Error. Mail Not Sent"
Else
Response.Write "Mail Sent"
End If
Set objMail = Nothing
End Sub
BuezaWebDev
12-05-2004, 07:59 PM
Why does PHP look better (syntactically) ? :/
Maybe because it reminds me of C++, Java. :P
russell
12-05-2004, 08:18 PM
BuezaWebDev
Why does PHP look better (syntactically) ? :/
To tell you the truth, it took me a while to decide that VB wasn't just a "toy" language for ameteurs. I was a C++, then Java guy for quite a few years, before taking a job at a dotcom doing all VB and ASP. Years later, I still catch myself doing thisfor(int i =0; i < someValue; i++) when I meant to do this:For i = 0 to someValue. You know what I mean. Even worse is i = i + 1 when I really, really want to type i++;
However, don't be fooled. ASP and VB are powerful, professional languages that can do pretty much anything you can want to do. For some of the lower level stuff, VB uses WinAPI calls (which means VB calls built-in C functions). VBs database APIs are, in my opionion, the cleanest actually.
Still, Bueza, Even though I have fully embraced VB, I like the look and feel of a C style language better.
:)
BuezaWebDev
12-06-2004, 03:29 AM
Hahah at the i = i + 1.
I got that wrong on my Delphi midterm when I put, "i++". The marker wrote, "This isn't Java."
Lol.
buntine
12-06-2004, 05:59 AM
Oh definetely, VBScript dies a horrible death when compared to a language whose syntax is based or inherited from C.
For i = 0 To 20 <-- Thats horrible!