locked
Send Mail with Attachments RRS feed

  • Question

  • Hi,

    I have 130 (and growing) excel file. I also have 69 mail addresses. I want to code in VB.NET 2012 to create send mail application.

    All I want to my app reads the text file that contains mail addreses for each excel file with (|) and then right side of each email name I will have excel file name.

    All this will be in one folder. User either run the app in that folder or use browse botton to load text file that contains mail addresses and excel file name.

    Then user will press the another botton and application will show data grid, that contains ID, Name, Mail Address, View and right side must have send button.

    When user clicks view button than another window shows homnay excel file belongs to that mail. Example 3 excel name will show. Then user press each file name and view the excel content. If its right then user return the main list and press send button rights sideof that ID and sends the mail with 3 excel file as attachment.

    App must use;

    Dim oApp As Outlook._Application
                oApp = New Outlook.Application()

    Can anyone kindly help me how to code my application...

    Thank you very much reading my post.

    Kind Regards,

    NTMS

    Thursday, January 2, 2014 3:02 PM

Answers

  • Hello NTMS,

    You can use the Add method of the Attachments class for adding attachments to the mail item object. The Send method of the MailItem class can be used for sending emails. You can find a sample code (C# and  VB.NET) in the How to: Send an E-mail Given the SMTP Address of an Account (Outlook) article, for example:

    // Create a new MailItem and set the To, Subject, and Body properties. 
    Outlook.MailItem newMail = (Outlook.MailItem)application.CreateItem(Outlook.OlItemType.olMailItem); 
    newMail.To = to; 
    newMail.Subject = subject; 
    newMail.Body = body; 
     
    newMail.Send();
    If you want to get the ready-made solution out of the box you need to hire a developer. You can find a lot of freelancers in the web.
    • Proposed as answer by George Hua Friday, January 3, 2014 2:53 AM
    • Marked as answer by George Hua Friday, January 10, 2014 2:00 AM
    Thursday, January 2, 2014 4:13 PM

All replies

  • Hello NTMS,

    You can use the Add method of the Attachments class for adding attachments to the mail item object. The Send method of the MailItem class can be used for sending emails. You can find a sample code (C# and  VB.NET) in the How to: Send an E-mail Given the SMTP Address of an Account (Outlook) article, for example:

    // Create a new MailItem and set the To, Subject, and Body properties. 
    Outlook.MailItem newMail = (Outlook.MailItem)application.CreateItem(Outlook.OlItemType.olMailItem); 
    newMail.To = to; 
    newMail.Subject = subject; 
    newMail.Body = body; 
     
    newMail.Send();
    If you want to get the ready-made solution out of the box you need to hire a developer. You can find a lot of freelancers in the web.
    • Proposed as answer by George Hua Friday, January 3, 2014 2:53 AM
    • Marked as answer by George Hua Friday, January 10, 2014 2:00 AM
    Thursday, January 2, 2014 4:13 PM
  • Thank you for reply.  How much will cost me if I get and freelcaers to creat this small apps?

    Kind Regards,

    Friday, January 3, 2014 6:51 PM
  • The current forum is for developers. I'd suggest googling for freelance web sites.
    Friday, January 3, 2014 7:53 PM