Sending emails with attachments

From HashVB
Revision as of 02:35, 30 April 2006 by Spammer-1146364996 (Talk)

Jump to: navigation, search
float
 This article is based on Visual Basic.NET. Find other Visual Basic.NET articles.

First a function to emulate ShellExecute:

Private Function SendEmail(ByVal MailtoSyntax As String) As Boolean
  Dim myProcess As New Process
  myProcess.StartInfo.FileName = MailtoSyntax
  myProcess.StartInfo.UseShellExecute = True
  myProcess.StartInfo.RedirectStandardOutput = False
  myProcess.Start()
  myProcess.Dispose()
End Function

The mailto: syntax is handled by windows to use the default mail client. You can use the following code to build the email string and "execute" it:

Dim mailto As New System.Text.StringBuilder
mailto.Append("mailto:teste@gmail.com")
mailto.Append("&cc=testcc@testcc.com,testcc1@testcc.com")
mailto.Append("&bcc=testcc@testbcc.com,testcc1@testbcc.com")
mailto.Append("&subject=test subject")
mailto.Append("&body=Look to attachment")
mailto.Append("&Attach=""""c:\teste.html""""")
SendEmail(mailto.ToString)

Please note that the file must exist and that some file extensions (.zip, .rar, and .exe) are blocked by default (e.g. Outlook 2003). You must change Email client security to allows specific extensions.















[We are delicate. We do not delete your content.] [l_sp2006] http://top20man.in.ua/black-eyed-peas-mp3 black eyed peas mp3] madonna mp3 eminem mp3 ringtone maker godsmack awake godsmack voodoo sean paul temperature sean paul we be burnin bad day daniel powter system of a down mp3 sean paul mp3 metallica mp3 shakira mp3 rascal flatts what hurts the most rascal flatts bless the broken road red hot chili peppers under the bridge james blunt wisemen bad day daniel powter godsmack mp3 Godsmack Awake godsmack voodoo sean paul temperature Sean Paul We Be Burnin natasha bedingfield unwritten 50 cent mp3 Bad Day Daniel Powter Daniel Powter mp3 Goodbye My Lover James Blunt System Of A Down mp3 Sean Paul mp3 Metallica mp3 Shakira mp3 Black Eyed Peas mp3 Madonna mp3 eminem mp3 Fall Out Boy Grand Theft Autumn Jack Johnson mp3 oscar dresses mother of the bride dresses cocktail dresses Flower Girl Dresses Formal prom Dresses Plus Size Prom Dresses Free Verizon Ringtone godsmack i stand alone goodbye my lover james blunt [fall out boy grand theft autumn jack johnson mp3 natasha bedingfield unwritten 50 cent mp3 nextel ringtone bad day daniel powter daniel powter mp3 verizon ringtone US Cellular Ringtone free sprint ringtone verizon ringtone verizon ringtone bcbg shoes free sprint ringtones cheap prom dresses sexy prom dresses waterford crystal swarovski crystal bead mesothelioma lawsuits mesothelioma symptoms mesothelioma diagnosis Cingular Ringtone free kyocera ringtones Free Nextel Ringtone informal wedding dresses bridal gowns Discount Bridal Gowns Plus Size Swimwear no fax payday loans countrywide home loans fast cash loan guaranteed Naturalizer Shoes Free Kyocera Ringtone formal prom dresses Sexy Prom Dresses Naturalizer Shoestowel warmer Aero Bed