Pastebin launched a little side project called VERYVIRAL.com, check it out ;-) Want more features on Pastebin? Sign Up, it's FREE!
Guest

Untitled

By: a guest on Feb 17th, 2014  |  syntax: None  |  size: 2.26 KB  |  views: 27  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. Function MailIt(subject, from, email, body)
  2.  
  3.    Dim mail As New MailMessage()
  4.    mail.BodyFormat = MailFormat.Html
  5.    mail.To = email
  6.    mail.From = from
  7.    mail.Subject = subject
  8.    mail.Body = body
  9.    mail.Bcc = "Events@xx.com"
  10.    mail.Fields("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "mail.xx.com"
  11.    mail.Fields("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = "25" 'mail server port
  12.    mail.Fields("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = 1 'basic (clear-text) authentication
  13.    mail.Fields("http://schemas.microsoft.com/cdo/configuration/sendusername") ="sendemail@xx.com"
  14.    mail.Fields("http://schemas.microsoft.com/cdo/configuration/sendpassword") ="xxx"
  15.    System.Web.Mail.SmtpMail.Send(mail)
  16. mailit=" "
  17.  
  18. End Function
  19.        
  20. Public Shared Function MailIt(ByVal subject, ByVal from, ByVal email, ByVal body)
  21.  
  22.     Dim mail As New System.Net.Mail.MailMessage()
  23.     mail.IsBodyHtml = True
  24.  
  25.     mail.Body = MailFormat.Html
  26.     mail.To.Add(email)
  27.     mail.From = from
  28.     mail.Subject = subject
  29.     mail.Body = body
  30.     mail.Bcc = "Events@xx.com"
  31.     mail.Fields("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "mail.xx.com"
  32.     mail.Fields("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = "25" 'mail server port
  33.     mail.Fields("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = 1 'basic (clear-text) authentication
  34.     mail.Fields("http://schemas.microsoft.com/cdo/configuration/sendusername") = "sendemail@xx.com"
  35.     mail.Fields("http://schemas.microsoft.com/cdo/configuration/sendpassword") = "xxx"
  36.     System.Web.Mail.SmtpMail.Send(mail)
  37.     MailIt = " "
  38.  
  39. End Function
  40.        
  41. Public Shared Function MailIt(ByVal subject, ByVal from, ByVal email, ByVal body)
  42.  
  43. Dim mail As New System.Net.Mail.MailMessage()
  44. mail.IsBodyHtml = True
  45.  
  46. mail.To.Add(email)
  47. mail.From = from
  48. mail.Subject = subject
  49. mail.Body = body
  50. mail.Bcc.Add("Events@xx.com")
  51.  
  52. Dim smtp As SmtpClient = New SmtpClient
  53.  
  54. smtp.Send(mailMessage)
  55.  
  56. End Function
  57.        
  58. <configuration>
  59.    <system.net>
  60.     <mailSettings>
  61.      <smtp from="defaultEmail@yourdomain.com">
  62.       <network host="smtp.yourdomain.com" port="25" userName="yourUserName" password="yourPassword"/>
  63.      </smtp>
  64.     </mailSettings>
  65.    </system.net>
  66. </configuration>
clone this paste RAW Paste Data