Solved

Open Outlook and email an attachment

Posted on 2011-09-27
5
448 Views
Last Modified: 2012-08-13
I am using Telerik Reporting for my Web Application.

With my attached code I can send an email with the report as an attachment.

Is there any way to open MS Outlook and send the attachment?
Private Sub MailReport(report As Telerik.Reporting.Report, from As String, [to] As String, subject As String, body As String)
	Dim reportProcessor As New ReportProcessor()
	Dim result As RenderingResult = reportProcessor.RenderReport("PDF", report, Nothing)
	Dim ms As New MemoryStream(result.DocumentBytes)
	ms.Position = 0
	Dim attachment As New Attachment(ms, report.Name + ".pdf")
	Dim msg As New MailMessage(from, [to], subject, body)
	msg.Attachments.Add(attachment)
	'smtp host is the name or IP of the host computer used for sending the email
	Dim smtpHost As String = "255.255.255.0"
	Dim client As New SmtpClient(smtpHost)
	client.Send(msg)
End Sub

Open in new window

0
Comment
Question by:lrbrister
  • 2
  • 2
5 Comments
 
LVL 69

Accepted Solution

by:
Éric Moreau earned 300 total points
Comment Utility
0
 
LVL 10

Assisted Solution

by:eguilherme
eguilherme earned 200 total points
Comment Utility
you could use office interop for that.. but i dont recommend it.. you dont have access to Exchange/SMTP ?

Outlook interop tutorial:

http://www.dreamincode.net/forums/topic/60975-office-automation/
0
 

Author Comment

by:lrbrister
Comment Utility
Thanks guys...two great answers a minute apart.

Any problem with a 300/200 split with the nod to emoreau: for being forst?
0
 
LVL 69

Expert Comment

by:Éric Moreau
Comment Utility
I have no problem. It is your question/points.
0
 

Author Closing Comment

by:lrbrister
Comment Utility
Great
Thanks guys
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

More often than not, we developers are confronted with a need: a need to make some kind of magic happen via code. Whether it is for a client, for the boss, or for our own personal projects, the need must be satisfied. Most of the time, the Framework…
A long time ago (May 2011), I have written an article showing you how to create a DLL using Visual Studio 2005 to be hosted in SQL Server 2005. That was valid at that time and it is still valid if you are still using these versions. You can still re…
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…
You have products, that come in variants and want to set different prices for them? Watch this micro tutorial that describes how to configure prices for Magento super attributes. Assigning simple products to configurable: We assigned simple products…

743 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now