In a previous post, I had some sample code for sending an e-mail from an ASP page with inline code using the CDO objects for Windows 2000 and Windows 2003.
I created a function, which I actually placed in an application class, to send e-mail from a feedback page.
Code:
' Send your message body here
Public Sub FeedBackMail()
Dim mSMTP As SmtpMail
Dim MailCurrent As MailMessage
MailCurrent = New MailMessage()
Dim sFileNameOnly As String
sFileNameOnly = ""
' Not currently implemented to attach files
' I had Set configuration for mail host in an XML config file
' this example is more abbreviated to show the workings
'Assign mail attributes
'Seperate multiple TO: email adresses with a comma seperator
MailCurrent.To = "administrator@mydomain.com"
' From needs to be a valid email return address
' or Lotus Notes Mail will discard the message as SPAM
MailCurrent.From = "ap-runner@mydomain.com
MailCurrent.Subject = "App Feedback from Web Site"
MailCurrent.Body = "this is the body of the e-mail"
' Need to use text as the mail body format
' for Lotus notes client
MailCurrent.BodyFormat = MailFormat.Text
' File to mail? add it to the email
If Len(sFileNameOnly) > 0 Then
MailCurrent.Attachments.Add(sFileNameOnly)
End If
'Set SMTP server to configured host
mSMTP.SmtpServer = "smtpserver.mydomain.com"
' by the way, this method does not work!
' mSMTP.SmtpServer.Insert(0, "smtpserver.mydomain.com")
'Send mail
mErrorMessage = ""
Try
mSMTP.Send(MailCurrent)
Catch e As Exception
' Notify that no e-mail was sent
mErrorMessage = "Error Sending e-mail:" & e.Message
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
All logos and trademarks in this site are property of their respective owner. The comments are property of their posters, all the rest (c) 2006 by Group29 Productions.
You can syndicate Group29 Productions news with an RSS Feeder using the file backend.php