about Emailing


Nov 8, 2005
Programming Experience
I'm developing a Mass Mailing tool for the office using VB.NET. I'm using the SMTP protocol to send mails using System.Web.Mail & the MailMessage class. The text emails are going fine. But I am facing a problem when I try mailing flyers. The flyers are developed in MS Word. Since it's got pictures & text & is layed out like a web page, I can paste it completely in the Body field (I'm using a Rich Text Box for the Mail Body section) of the mail program interface. It appears properly & upon clicking 'Send' the mail goes through but sans the flyer. Recepients get empty mails. I've also tried this:

msg.BodyFormat = System.Web.Mail.MailFormat.Html

but to no avail. I'm giving the basic code of what I'm doing, below. Any suggestions/help is welcome. Thanks a lot in advance :eek:

[SIZE=2][COLOR=#0000ff]Dim[/COLOR][/SIZE][SIZE=2][COLOR=#323232] msg [/COLOR][/SIZE][SIZE=2][COLOR=#0000ff]As[/COLOR][/SIZE][SIZE=2][COLOR=#323232] MailMessage[/COLOR][/SIZE]
[SIZE=2][SIZE=2][COLOR=#0000ff]Dim[/COLOR][/SIZE][SIZE=2][COLOR=#323232] i, j, cnt, firstTime, len [/COLOR][/SIZE][SIZE=2][COLOR=#0000ff]As[/COLOR][/SIZE][SIZE=2][COLOR=#0000ff]Integer[/COLOR][/SIZE]
[SIZE=2][COLOR=black]Blah, Blah, Blah (Code to populate & iterate through dataset to fetch 1 emailid at a time which works fine)[/COLOR][/SIZE]
[/COLOR][/SIZE][SIZE=2][SIZE=2]msg = [/SIZE][SIZE=2][COLOR=#0000ff]New[/COLOR][/SIZE][SIZE=2] MailMessage
  msg.From = txtFrom.Text
  msg.To = dsCustomers.Tables(0).Rows(j)("emailid")
  msg.Subject = txtHeading.Text
[SIZE=2] msg.Body = txtBody.Text
[SIZE=2] SmtpMail.SmtpServer = "172.*.*.*"
  MessageBox.Show("Mail sent successfully to : " + msg.To,"Success",MessageBoxButtons.OK, MessageBoxIcon.Exclamation)
[/SIZE][SIZE=2][COLOR=#0000ff]Catch[/COLOR][/SIZE][SIZE=2] ex [/SIZE][SIZE=2][COLOR=#0000ff]As[/COLOR][/SIZE][SIZE=2] Exception
  MessageBox.Show("Error in sending Email : " + ex.Message + " : " + ex.StackTrace, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error)



New member
Feb 23, 2006
Programming Experience
Plz solve my this question


I m a beginner in VB.NET but i have to develpo one application in which
i have to send an email and i have to take the mail ids from the database as i m beginner so i am facing lots of problems in it.
can u plz help me out by sending the code to me.
I m also giving my personal id to you i.e.:-himanibhandari@rediffmail.com
Top Bottom