[SIZE=2][/SIZE][SIZE=2][COLOR=#0000ff]Function[/COLOR][/SIZE][SIZE=2] SendEmailNow([/SIZE][SIZE=2][COLOR=#0000ff]ByVal[/COLOR][/SIZE][SIZE=2] From [/SIZE][SIZE=2][COLOR=#0000ff]As[/COLOR][/SIZE][SIZE=2] [/SIZE][SIZE=2][COLOR=#0000ff]String[/COLOR][/SIZE][SIZE=2], [/SIZE][SIZE=2][COLOR=#0000ff]ByVal[/COLOR][/SIZE][SIZE=2] ToAdd [/SIZE][SIZE=2][COLOR=#0000ff]As[/COLOR][/SIZE][SIZE=2] [/SIZE][SIZE=2][COLOR=#0000ff]String[/COLOR][/SIZE][SIZE=2], [/SIZE][SIZE=2][COLOR=#0000ff]ByVal[/COLOR][/SIZE][SIZE=2] Subject [/SIZE][SIZE=2][COLOR=#0000ff]As[/COLOR][/SIZE][SIZE=2] [/SIZE][SIZE=2][COLOR=#0000ff]String[/COLOR][/SIZE][SIZE=2], [/SIZE][SIZE=2][COLOR=#0000ff]ByVal[/COLOR][/SIZE][SIZE=2] Body [/SIZE][SIZE=2][COLOR=#0000ff]As[/COLOR][/SIZE][SIZE=2] [/SIZE][SIZE=2][COLOR=#0000ff]String[/COLOR][/SIZE][SIZE=2], [/SIZE][SIZE=2][COLOR=#0000ff]ByVal[/COLOR][/SIZE][SIZE=2] HTML [/SIZE][SIZE=2][COLOR=#0000ff]As[/COLOR][/SIZE][SIZE=2] [/SIZE][SIZE=2][COLOR=#0000ff]Boolean[/COLOR][/SIZE][SIZE=2], [/SIZE][SIZE=2][COLOR=#0000ff]ByVal[/COLOR][/SIZE][SIZE=2] DBConnection [/SIZE][SIZE=2][COLOR=#0000ff]As[/COLOR][/SIZE][SIZE=2] SqlClient.SqlConnection, [/SIZE][SIZE=2][COLOR=#0000ff]ByVal[/COLOR][/SIZE][SIZE=2] StealthSend [/SIZE][SIZE=2][COLOR=#0000ff]As[/COLOR][/SIZE][SIZE=2] [/SIZE][SIZE=2][COLOR=#0000ff]Boolean[/COLOR][/SIZE][SIZE=2], [/SIZE][SIZE=2][COLOR=#0000ff]Optional[/COLOR][/SIZE][SIZE=2] [/SIZE][SIZE=2][COLOR=#0000ff]ByVal[/COLOR][/SIZE][SIZE=2] LinkID [/SIZE][SIZE=2][COLOR=#0000ff]As[/COLOR][/SIZE][SIZE=2] [/SIZE][SIZE=2][COLOR=#0000ff]String[/COLOR][/SIZE][SIZE=2] = [/SIZE][SIZE=2][COLOR=#800000]""[/COLOR][/SIZE][SIZE=2], [/SIZE][SIZE=2][COLOR=#0000ff]Optional[/COLOR][/SIZE][SIZE=2] [/SIZE][SIZE=2][COLOR=#0000ff]ByVal[/COLOR][/SIZE][SIZE=2] Attachments [/SIZE][SIZE=2][COLOR=#0000ff]As[/COLOR][/SIZE][SIZE=2] [/SIZE][SIZE=2][COLOR=#0000ff]String[/COLOR][/SIZE][SIZE=2] = [/SIZE][SIZE=2][COLOR=#800000]""[/COLOR][/SIZE][SIZE=2]) [/SIZE][SIZE=2][COLOR=#0000ff]As[/COLOR][/SIZE][SIZE=2] [/SIZE][SIZE=2][COLOR=#0000ff]Boolean
[/COLOR][/SIZE][SIZE=2][/SIZE][SIZE=2][COLOR=#0000ff]Dim[/COLOR][/SIZE][SIZE=2] Send_Mail [/SIZE][SIZE=2][COLOR=#0000ff]As[/COLOR][/SIZE][SIZE=2] SmtpClient = [/SIZE][SIZE=2][COLOR=#0000ff]New[/COLOR][/SIZE][SIZE=2] SmtpClient(SMTPServer)
[/SIZE][SIZE=2][COLOR=#0000ff]Dim[/COLOR][/SIZE][SIZE=2] My_Mail [/SIZE][SIZE=2][COLOR=#0000ff]As[/COLOR][/SIZE][SIZE=2] System.Net.Mail.MailMessage
[/SIZE][SIZE=2][COLOR=#0000ff]Dim[/COLOR][/SIZE][SIZE=2] My_Attachment [/SIZE][SIZE=2][COLOR=#0000ff]As[/COLOR][/SIZE][SIZE=2] System.Net.Mail.Attachment
[/SIZE][SIZE=2][COLOR=#0000ff]Dim[/COLOR][/SIZE][SIZE=2] FoundError [/SIZE][SIZE=2][COLOR=#0000ff]As[/COLOR][/SIZE][SIZE=2] [/SIZE][SIZE=2][COLOR=#0000ff]Boolean[/COLOR][/SIZE][SIZE=2] = [/SIZE][SIZE=2][COLOR=#0000ff]False
[/COLOR][/SIZE][SIZE=2][/SIZE][SIZE=2][COLOR=#0000ff]Dim[/COLOR][/SIZE][SIZE=2] TempAttachments() [/SIZE][SIZE=2][COLOR=#0000ff]As[/COLOR][/SIZE][SIZE=2] [/SIZE][SIZE=2][COLOR=#0000ff]String
[/COLOR][/SIZE][SIZE=2][/SIZE][SIZE=2][COLOR=#0000ff]Dim[/COLOR][/SIZE][SIZE=2] TempAttachment [/SIZE][SIZE=2][COLOR=#0000ff]As[/COLOR][/SIZE][SIZE=2] [/SIZE][SIZE=2][COLOR=#0000ff]String
[/COLOR][/SIZE][SIZE=2][/SIZE][SIZE=2][COLOR=#0000ff]Dim[/COLOR][/SIZE][SIZE=2] FromAddress [/SIZE][SIZE=2][COLOR=#0000ff]As[/COLOR][/SIZE][SIZE=2] Net.Mail.MailAddress = [/SIZE][SIZE=2][COLOR=#0000ff]New[/COLOR][/SIZE][SIZE=2] Net.Mail.MailAddress(From, From)
[/SIZE][SIZE=2][COLOR=#0000ff]Dim[/COLOR][/SIZE][SIZE=2] TempObject [/SIZE][SIZE=2][COLOR=#0000ff]As[/COLOR][/SIZE][SIZE=2] [/SIZE][SIZE=2][COLOR=#0000ff]New[/COLOR][/SIZE][SIZE=2] [/SIZE][SIZE=2][COLOR=#0000ff]Object
[/COLOR][/SIZE][SIZE=2]
[/SIZE][SIZE=2][COLOR=#008000]'=================================================
[/COLOR][/SIZE][SIZE=2][/SIZE][SIZE=2][COLOR=#008000]'== Set Up New E-Mail ==
[/COLOR][/SIZE][SIZE=2][/SIZE][SIZE=2][COLOR=#008000]'=================================================
[/COLOR][/SIZE][SIZE=2]My_Mail = [/SIZE][SIZE=2][COLOR=#0000ff]New[/COLOR][/SIZE][SIZE=2] System.Net.Mail.MailMessage
My_Mail.To.Add(ToAdd)
My_Mail.From = FromAddress
My_Mail.Subject = Subject
My_Mail.Body = Body
[/SIZE][SIZE=2][COLOR=#0000ff]If[/COLOR][/SIZE][SIZE=2] HTML [/SIZE][SIZE=2][COLOR=#0000ff]Then
[/COLOR][/SIZE][SIZE=2]My_Mail.IsBodyHtml = [/SIZE][SIZE=2][COLOR=#0000ff]True
[/COLOR][/SIZE][SIZE=2][/SIZE][SIZE=2][COLOR=#0000ff]Else
[/COLOR][/SIZE][SIZE=2]My_Mail.IsBodyHtml = [/SIZE][SIZE=2][COLOR=#0000ff]False
[/COLOR][/SIZE][SIZE=2][/SIZE][SIZE=2][COLOR=#0000ff]End[/COLOR][/SIZE][SIZE=2] [/SIZE][SIZE=2][COLOR=#0000ff]If
[/COLOR][/SIZE][SIZE=2][/SIZE][SIZE=2][COLOR=#0000ff]If[/COLOR][/SIZE][SIZE=2] Attachments <> [/SIZE][SIZE=2][COLOR=#800000]""[/COLOR][/SIZE][SIZE=2] [/SIZE][SIZE=2][COLOR=#0000ff]Then
[/COLOR][/SIZE][SIZE=2]TempAttachments = Split(Attachments, Chr(0))
[/SIZE][SIZE=2][COLOR=#0000ff]For[/COLOR][/SIZE][SIZE=2] [/SIZE][SIZE=2][COLOR=#0000ff]Each[/COLOR][/SIZE][SIZE=2] TempAttachment [/SIZE][SIZE=2][COLOR=#0000ff]In[/COLOR][/SIZE][SIZE=2] TempAttachments
[/SIZE][SIZE=2][COLOR=#0000ff]If[/COLOR][/SIZE][SIZE=2] TempAttachment <> [/SIZE][SIZE=2][COLOR=#800000]""[/COLOR][/SIZE][SIZE=2] [/SIZE][SIZE=2][COLOR=#0000ff]Then
[/COLOR][/SIZE][SIZE=2]My_Attachment = [/SIZE][SIZE=2][COLOR=#0000ff]New[/COLOR][/SIZE][SIZE=2] System.Net.Mail.Attachment(TempAttachment)
My_Mail.Attachments.Add(My_Attachment)
[/SIZE][SIZE=2][COLOR=#0000ff]End[/COLOR][/SIZE][SIZE=2] [/SIZE][SIZE=2][COLOR=#0000ff]If
[/COLOR][/SIZE][SIZE=2][/SIZE][SIZE=2][COLOR=#0000ff]Next
[/COLOR][/SIZE][SIZE=2][/SIZE][SIZE=2][COLOR=#0000ff]End[/COLOR][/SIZE][SIZE=2] [/SIZE][SIZE=2][COLOR=#0000ff]If
[/COLOR][/SIZE][SIZE=2][/SIZE][SIZE=2][COLOR=#008000]'====================================================
[/COLOR][/SIZE][SIZE=2][/SIZE][SIZE=2][COLOR=#008000]'== Try To Send The E-Mail, if it Fails Log Event ==
[/COLOR][/SIZE][SIZE=2][/SIZE][SIZE=2][COLOR=#008000]'====================================================
[/COLOR][/SIZE][SIZE=2][/SIZE][SIZE=2][COLOR=#0000ff]Try
[/COLOR][/SIZE][SIZE=2][/SIZE][SIZE=2][COLOR=#0000ff]If[/COLOR][/SIZE][SIZE=2] StealthSend = [/SIZE][SIZE=2][COLOR=#0000ff]False[/COLOR][/SIZE][SIZE=2] [/SIZE][SIZE=2][COLOR=#0000ff]Then
[/COLOR][/SIZE][SIZE=2]ShowMessageWindow([/SIZE][SIZE=2][COLOR=#800000]"Send E-Mail..."[/COLOR][/SIZE][SIZE=2], [/SIZE][SIZE=2][COLOR=#800000]"Sending to:-"[/COLOR][/SIZE][SIZE=2] & vbCrLf & vbCrLf & ToAdd)
[/SIZE][SIZE=2][COLOR=#0000ff]End[/COLOR][/SIZE][SIZE=2] [/SIZE][SIZE=2][COLOR=#0000ff]If
[/COLOR][/SIZE][SIZE=2]Send_Mail.DeliveryMethod = SmtpDeliveryMethod.Network
Send_Mail.Send(My_Mail)
My_Mail.Dispose()
My_Mail = [/SIZE][SIZE=2][COLOR=#0000ff]Nothing
[/COLOR][/SIZE][SIZE=2]Send_Mail = [/SIZE][SIZE=2][COLOR=#0000ff]Nothing
[/COLOR][/SIZE][SIZE=2][/SIZE][SIZE=2][COLOR=#0000ff]Catch[/COLOR][/SIZE][SIZE=2] ex [/SIZE][SIZE=2][COLOR=#0000ff]As[/COLOR][/SIZE][SIZE=2] Exception
[/SIZE][SIZE=2][COLOR=#0000ff]Me[/COLOR][/SIZE][SIZE=2].LogEvent(DBConnection, [/SIZE][SIZE=2][COLOR=#800000]"Failed E-Mail Error Message"[/COLOR][/SIZE][SIZE=2], ex.Source & [/SIZE][SIZE=2][COLOR=#800000]" - "[/COLOR][/SIZE][SIZE=2] & ex.Message, [/SIZE][SIZE=2][COLOR=#800000]"ERROR"[/COLOR][/SIZE][SIZE=2], System.DateTime.Now.ToString([/SIZE][SIZE=2][COLOR=#800000]"dd/MM/yyyy HH:mm:ss"[/COLOR][/SIZE][SIZE=2]))
[/SIZE][SIZE=2][COLOR=#0000ff]Me[/COLOR][/SIZE][SIZE=2].LogEvent(DBConnection, [/SIZE][SIZE=2][COLOR=#800000]"Failed E-Mail Sent To"[/COLOR][/SIZE][SIZE=2], ToAdd, [/SIZE][SIZE=2][COLOR=#800000]"ERROR"[/COLOR][/SIZE][SIZE=2], System.DateTime.Now.ToString([/SIZE][SIZE=2][COLOR=#800000]"dd/MM/yyyy HH:mm:ss"[/COLOR][/SIZE][SIZE=2]))
MsgBox(ex.Message)
FoundError = [/SIZE][SIZE=2][COLOR=#0000ff]True
[/COLOR][/SIZE][SIZE=2][/SIZE][SIZE=2][COLOR=#0000ff]End[/COLOR][/SIZE][SIZE=2] [/SIZE][SIZE=2][COLOR=#0000ff]Try
[/COLOR][/SIZE][SIZE=2][/SIZE][SIZE=2][COLOR=#008000]'=================================================
[/COLOR][/SIZE][SIZE=2][/SIZE][SIZE=2][COLOR=#008000]'== If There is a LinkID, Save The E-Mail ==
[/COLOR][/SIZE][SIZE=2][/SIZE][SIZE=2][COLOR=#008000]'=================================================
[/COLOR][/SIZE][SIZE=2][/SIZE][SIZE=2][COLOR=#0000ff]If[/COLOR][/SIZE][SIZE=2] [/SIZE][SIZE=2][COLOR=#0000ff]Not[/COLOR][/SIZE][SIZE=2] FoundError [/SIZE][SIZE=2][COLOR=#0000ff]And[/COLOR][/SIZE][SIZE=2] LinkID <> [/SIZE][SIZE=2][COLOR=#800000]""[/COLOR][/SIZE][SIZE=2] [/SIZE][SIZE=2][COLOR=#0000ff]Then
[/COLOR][/SIZE][SIZE=2][/SIZE][SIZE=2][COLOR=#0000ff]Dim[/COLOR][/SIZE][SIZE=2] SQL [/SIZE][SIZE=2][COLOR=#0000ff]As[/COLOR][/SIZE][SIZE=2] [/SIZE][SIZE=2][COLOR=#0000ff]String
[/COLOR][/SIZE][SIZE=2]Subject = [/SIZE][SIZE=2][COLOR=#0000ff]Me[/COLOR][/SIZE][SIZE=2].ReplaceForDB(Subject)
Body = [/SIZE][SIZE=2][COLOR=#0000ff]Me[/COLOR][/SIZE][SIZE=2].ReplaceForDB(Body)
SQL = [/SIZE][SIZE=2][COLOR=#800000]"Insert Into EmailsTable (ID,LinkID,DateTimeSent,[To],[From],[Subject],[Body],[HTML],[Sent], Attachments) Values ('"[/COLOR][/SIZE][SIZE=2] & [/SIZE][SIZE=2][COLOR=#0000ff]Me[/COLOR][/SIZE][SIZE=2].Get_Cripto([/SIZE][SIZE=2][COLOR=#800000]"EMAIL"[/COLOR][/SIZE][SIZE=2]) & [/SIZE][SIZE=2][COLOR=#800000]"', '"[/COLOR][/SIZE][SIZE=2] & LinkID & [/SIZE][SIZE=2][COLOR=#800000]"','"[/COLOR][/SIZE][SIZE=2] & System.DateTime.Now.ToString([/SIZE][SIZE=2][COLOR=#800000]"MM/dd/yyyy HH:mm"[/COLOR][/SIZE][SIZE=2]) & [/SIZE][SIZE=2][COLOR=#800000]"', '"[/COLOR][/SIZE][SIZE=2] & ToAdd & [/SIZE][SIZE=2][COLOR=#800000]"', '"[/COLOR][/SIZE][SIZE=2] & From & [/SIZE][SIZE=2][COLOR=#800000]"', '"[/COLOR][/SIZE][SIZE=2] & Subject & [/SIZE][SIZE=2][COLOR=#800000]"', '"[/COLOR][/SIZE][SIZE=2] & Body & [/SIZE][SIZE=2][COLOR=#800000]"', '"[/COLOR][/SIZE][SIZE=2] & Int(HTML) & [/SIZE][SIZE=2][COLOR=#800000]"', 1, '"[/COLOR][/SIZE][SIZE=2] & Attachments & [/SIZE][SIZE=2][COLOR=#800000]"')"
[/COLOR][/SIZE][SIZE=2][/SIZE][SIZE=2][COLOR=#0000ff]Me[/COLOR][/SIZE][SIZE=2].UpdateDatabase(SQL, DBConnection)
[/SIZE][SIZE=2][COLOR=#0000ff]End[/COLOR][/SIZE][SIZE=2] [/SIZE][SIZE=2][COLOR=#0000ff]If
[/COLOR][/SIZE][SIZE=2][/SIZE][SIZE=2][COLOR=#0000ff]End[/COLOR][/SIZE][SIZE=2] [/SIZE][SIZE=2][COLOR=#0000ff]Function
[/COLOR][/SIZE]