VB.NET‎ > ‎


Send mail out using visual basic .net

create a .aspx file with the following code

<%@ Import Namespace="System.Web.Mail"%> <script language="VBScript" Debug="true" runat="server"> sub Page_Load() Dim oMsg As MailMessage = New MailMessage() oMsg.From = "test@compute.info" oMsg.To = "spam@compute.info" oMsg.Subject = "Send using Web Mail (VB)" oMsg.BodyFormat = MailFormat.Html oMsg.Body = "<HTML><BODY>mail test!!!!!</BODY></HTML>" 'Dim sFile As String = "D:\FTP\username\Htdocs\Hello.txt" 'Dim oAttch As MailAttachment = New MailAttachment(sFile, MailEncoding.Base64) 'oMsg.Attachments.Add(oAttch) SmtpMail.SmtpServer = "localhost" SmtpMail.Send(oMsg) oMsg = Nothing 'oAttch = Nothing end sub </script>