create outlook email

Experts:

I've created a webform that creates a document. I'm trying to add the document to an email that my users can then review and send on to whomever. Can anyone assist in how to create the email document please?

Thanks in advance,
telliot79Asked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Robberbaron (robr)Commented:
this is from a working app.
            //create output file
            dynamic oApp = null;
            dynamic oMsg = null;

            dynamic oAttach = null;
            int olMailItem = 0;
            //int olFormatPlain = 1;
            int olFormatHTML = 2;
            int olAttByValue = 1;
            oApp = Activator.CreateInstance(Type.GetTypeFromProgID("Outlook.Application"));

            //Outlook.Application oApp = new Outlook.Application();
            // Outlook.MailItem oMsg = null;
            //Outlook.UserProperty olProjId = null;
            //Outlook.UserProperties props;

            string ID_Title = ""; string bodyTop = ""; string bodyMain = ""; string bodyBundle = "";
            string bodyFooter = "";
            try
            {
                //oMsg = oApp.CreateItem(Outlook.OlItemType.olMailItem) as Outlook.MailItem;
                oMsg = oApp.CreateItem(olMailItem);

                oMsg.Subject = "file download link";
                oMsg.BodyFormat = olFormatHTML;
                oMsg.Body = "file send";
                oMsg.HTMLBody = "<br>";
                bodyTop = "<p style='color:darkblue'><br> The following files are too large to email so please follow the links to download from our server<br />";

                int pos = (int)oMsg.Body.Length + 1;
                //Microsoft.Office.Interop.Outlook.Attachment 
 
                oAttach = oMsg.Attachments.Add(fi.FullName, olAttByValue, pos, "Transmittal");

                bodyMain += "</ul>";
                bodyMain += "<hr>";
		
		oMsg.HTMLBody += bodyTop + bodyMain ;

                oMsg.HTMLBody += "";
                oMsg.Save();
                worker.ReportProgress(99);
                oMsg.Display(true);
                
            }
            catch (Exception ex)
            {
                System.Windows.Forms.MessageBox.Show(ex.Message);
            }
            finally
            {
                if (oMsg != null) Marshal.ReleaseComObject(oMsg);
            }

Open in new window

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
telliot79Author Commented:
thx
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
.NET Programming

From novice to tech pro — start learning today.