none
Powershell send mail with custom voting option without using outlook object? RRS feed

  • Question

  • Hi,

    I am currently sending emails through using new-object Net.Mail.SMTPclient because the server that runs the script does not have outlook application.

    My goal right now is to be able to send automated emails that have custom voting option on it where people who receive it in outlook can respond through the voting system.

    Is it possible to do this without using new-object -com outlook.application?

    Wednesday, January 15, 2014 5:28 PM

Answers

  • Not really.  You would have to be able to design a custom form in HTML and add all of the office/outlook styles and objects.

    You could build it in Outlook and transfer the HTML to another place and then just edit the HTML.


    ¯\_(ツ)_/¯

    • Marked as answer by BassPS Wednesday, January 15, 2014 6:26 PM
    Wednesday, January 15, 2014 6:00 PM

All replies

  • Hi,

    I am currently sending emails through using new-object Net.Mail.SMTPclient because the server that runs the script does not have outlook application.

    My goal right now is to be able to send automated emails that have custom voting option on it where people who receive it in outlook can respond through the voting system.

    Is it possible to do this without using new-object -com outlook.applicatio

    • Merged by Just Karl Wednesday, January 15, 2014 7:38 PM Duplicate
    Wednesday, January 15, 2014 5:45 PM
  • Not really.  You would have to be able to design a custom form in HTML and add all of the office/outlook styles and objects.

    You could build it in Outlook and transfer the HTML to another place and then just edit the HTML.


    ¯\_(ツ)_/¯

    • Marked as answer by BassPS Wednesday, January 15, 2014 6:26 PM
    Wednesday, January 15, 2014 6:00 PM
  • Not really.  You would have to be able to design a custom form in HTML and add all of the office/outlook styles and objects.

    You could build it in Outlook and transfer the HTML to another place and then just edit the HTML.


    ¯\_(ツ)_/¯

    How would you build it in outlook and transfer the html?
    Wednesday, January 15, 2014 6:28 PM
  • Create the message with voting buttons and save it as HTML.  Might work.  I have never tried it.


    ¯\_(ツ)_/¯

    Wednesday, January 15, 2014 7:13 PM
  • Don't listen to those answers. It is very possible and I use it every day.  You tap into the Outlook COM object using Powershell. Look at this code.

    $olComObject = new-object -comobject outlook.application
    $NewMail = $olComObject .CreateItem(0)
    $NewMail.Subject = "Testing Voting Options"
    $HTMLBody = "Please use the attached voting buttons in this email to select the best scripting language!"
    $NewMail.HTMLBody = $HTMLBody
    $NewMail.To = "recipient@domain.com"
    $NewMail.VotingOptions="VBScript;PowerShell;Python;Ruby;Perl"
    $NewMail.Send()

    • Proposed as answer by smitbry Friday, September 26, 2014 5:02 PM
    • Unproposed as answer by Bill_StewartModerator Friday, September 26, 2014 6:16 PM
    Friday, September 26, 2014 5:02 PM
  • Question clearly states "without using Outlook object"


    ¯\_(ツ)_/¯

    Friday, September 26, 2014 5:25 PM
  • Don't listen to those answers. It is very possible and I use it every day.  You tap into the Outlook COM object using Powershell. Look at this code.

    $olComObject = new-object -comobject outlook.application
    $NewMail = $olComObject .CreateItem(0)
    $NewMail.Subject = "Testing Voting Options"
    $HTMLBody = "Please use the attached voting buttons in this email to select the best scripting language!"
    $NewMail.HTMLBody = $HTMLBody
    $NewMail.To = "recipient@domain.com"
    $NewMail.VotingOptions="VBScript;PowerShell;Python;Ruby;Perl"
    $NewMail.Send()


    Go back and read the first post again. You may want to delete your post.

    Don't retire TechNet! - (Don't give up yet - 13,085+ strong and growing)

    Friday, September 26, 2014 5:28 PM