Results 1 to 3 of 3

Thread: Outlook voting buttons - MailMessage class

  1. #1

    Thread Starter
    Addicted Member silentthread's Avatar
    Join Date
    Jun 2006
    Location
    Miami, Florida
    Posts
    143

    Smile Outlook voting buttons - MailMessage class

    Hi,

    Does anyone know if it's possible to add a custom header to the MailMessage class in vb.net for voting buttons?

    I was able to add a custom header for "Reply-to", and send the email, but I need to know if it's possible for vb.net.

    Should I be using other classes or components for this?
    Here is sample code....


    code Code:
    1. Imports System.Web.Mail
    2.  
    3. Module Module1
    4.  
    5.     Sub Main()
    6.  
    7.         Dim message As New MailMessage
    8.         message.To = "[email protected]"
    9.         message.From = "[email protected]"
    10.         message.Subject = "test"
    11.         message.Body = "test"
    12.         message.Headers.Add("?", "?") 'what goes here?
    13.  
    14.         Dim email As SmtpMail
    15.         email.SmtpServer = "mail.bubba.com"
    16.  
    17.         email.Send(message)
    18.  
    19.     End Sub
    20.  
    21. End Module
    Watch media as you download it! Excellent tool!
    FREE CUBA!
    MyBlog
    If you feel my post has helped, please rate it.

  2. #2

    Thread Starter
    Addicted Member silentthread's Avatar
    Join Date
    Jun 2006
    Location
    Miami, Florida
    Posts
    143

    Re: Outlook voting buttons - MailMessage class

    Well, I got close, but then I could not find a way to convert an outlook.mailitem into a mailmessage item, so I can try to change the "from"

    Here is how you do it in vb.net using redemption tool to avoid the outlook security thingy...

    vb Code:
    1. Imports Microsoft.Office.Interop
    2. Imports System.Web.Mail
    3.  
    4. Module Module1
    5.  
    6.     Sub Main()
    7.  
    8.         Dim olApp As Outlook.Application
    9.         olApp = CreateObject("Outlook.Application")
    10.         Dim safeItem As New Redemption.SafeMailItem
    11.         Dim olItem As Outlook.MailItem
    12.         olItem = olApp.CreateItem(Outlook.OlItemType.olMailItem)
    13.         With olItem
    14.             .To = "[email protected]"
    15.             .Subject = "vote test"
    16.             .Body = "test message"
    17.             .VotingOptions = "Yes;No"
    18.         End With
    19.         safeItem.Item = olItem
    20.         safeItem.Send()
    21.  
    22.         olItem = Nothing
    23.         olApp = Nothing
    24.  
    25.     End Sub
    Watch media as you download it! Excellent tool!
    FREE CUBA!
    MyBlog
    If you feel my post has helped, please rate it.

  3. #3

    Thread Starter
    Addicted Member silentthread's Avatar
    Join Date
    Jun 2006
    Location
    Miami, Florida
    Posts
    143

    Re: Outlook voting buttons - MailMessage class

    The only problem with this code is that you need to have an Outlook profile on the machine that is sending the email, and you cannot change the "from" address. :-(
    Watch media as you download it! Excellent tool!
    FREE CUBA!
    MyBlog
    If you feel my post has helped, please rate it.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width