Click here to Skip to main content
15,884,473 members
Please Sign up or sign in to vote.
5.00/5 (1 vote)
See more:
VB
Imports System.Net.Mail

Shared Function sendMail(ByVal fromName As String, ByVal from As String, ByVal rcpt As String, ByVal subject As String, ByVal body As String, ByVal isBodyHTML As Boolean, ByVal BCCRcpt As String) As Boolean 'Returns True if send ok, False if errors
            Dim pEmailMessage As New MailMessage
            Dim pSmtpClient As New SmtpClient
            Dim pSmtpServer As String
            Dim pSmtpUser As String
            Dim pSmtpPass As String
            Dim pMailServerUser As String

            pSmtpServer = "chnexc001.gavsin.com"
            pMailServerUser = String.Empty
            pSmtpUser = "root"
            pSmtpPass = "draddots"

            pEmailMessage.From = New System.Net.Mail.MailAddress(from, fromName)
            If rcpt <> String.Empty Then
                pEmailMessage.To.Add(rcpt)
            End If
            If BCCRcpt <> String.Empty Then
                pEmailMessage.Bcc.Add(BCCRcpt)
            End If

            pEmailMessage.Subject = subject
            pEmailMessage.Body = body
            pEmailMessage.IsBodyHtml = isBodyHTML
            pEmailMessage.Priority = System.Net.Mail.MailPriority.Normal
            pSmtpClient.Host = pSmtpServer

            If Trim(pSmtpUser) <> "" Then
                pSmtpClient.Credentials = New System.Net.NetworkCredential(pSmtpUser, pSmtpPass)
            End If
            Try
                pEmailMessage.IsBodyHtml = True
                pSmtpClient.Send(pEmailMessage)
                sendMail = True
            Catch ex As Exception
                sendMail = False
            End Try
        End Function
Posted
Updated 16-Sep-21 23:23pm
Comments
Simon_Whale 8-Nov-10 4:01am    
Whats the problem? where are you needing help? - no one will read the code without knowing what problem you are having

If you are trying to avoid a client spam filter, you won't be able to as those settings are pretty much entirely configured on the client side and each user can customize it however they please.

That is why you see messages on the forums here where people are seeing their mail updates, etc. and they are being directed to update their spam filters to allow the CP mails through. If it could be done from the server side, I'm pretty sure this would be one site that would pull it off.
 
Share this answer
 
First, noone is going to read all that code.

Second, you cannot avoid a clients spam filter, no matter what you do.

Attempting to do so will probabyl get you some time in prison too! Have a nice time!
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900