Jump to content

Email in .NET (VB)


slade8200

Recommended Posts

I'm new to this .NET stuff, but seem have my email code almost working. When the run the code, it has an error on the "Imports" statements. I've searched all over the place and seen many different ways of doing it and has so far confused me. I'd love it if someone could point me in the right direction.

<html><body><%'@Import Namespace="System.Web.Mail"Imports System;Imports System.Web.Mail;Dim firstName as StringDim lastName as StringDim address as StringfirstName = Request.QueryString("FirstName")lastName = Request.QueryString("LastName")address = Request.QueryString("address")Response.Write(firstName)Response.Write(lastName)Response.Write(address)Dim msg As MailMessage = New MailMessage()msg.To = "x123@xcommunications.com"msg.From = "me@test.com"msg.Subject = "Test message"msg.BodyFormat = MailFormat.Textmsg.Body = "Message body"SmtpMail.SmtpServer = "10.10.10.6"TrySmtpMail.Send(msg)Catch ex As HttpExceptionResponse.Write("Error: " + ex.ToString())Catch ex As ExceptionResponse.Write("Error: " + ex.ToString())End Try%></body></html>

Link to comment
Share on other sites

What is the error? Are you sure you're supposed to have those semicolons in there?

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...