Custom Button in Outlook to send Emails to Salesforce


It often comes handy to have a button in Outlook, which allows you to automatically forward any email to Salesforce/e2a. To create this button, please follow steps below:

  • STEP 1: Add the Macro to Outlook:
  1. Open Outlook and press 'alt' + 'F8' on your keyboard. This will open your Macro window.
  2. Enter 'Macro Name' and press 'Create'. This will open a new window. Please enter Macro Code Provided below. In 'emailAddress' enter the Email Service Address where you would like to forward your emails to. Save your code and close the window.

    Sub SendEmailToSalesforce()
    Dim emailAddress As String
    Dim objMail As Outlook.MailItem
    Dim strbody As String
    Dim oldmsg As String
    Dim senderaddress As String
    Dim addresstype As Integer

    ' Set this variable as your helpdesk e-mail address
    emailAddress = "EmailServiceAddress"

    Set objItem = GetCurrentItem()
    Set objMail = objItem.Forward

    ' Sender E=mail Address
    senderaddress = objItem.SenderEmailAddress

    'Searches for @ in the email address to determine if it is an exchange user
    addresstype = InStr(senderaddress, "@")

    ' If the address is an Exchange DN use the Senders Name
    If addresstype = 0 Then
    senderaddress = objItem.SenderName
    End If

    'adds the senders e-mail address as the created by object for the ticket and appends the message body
    strbody = "#created by " & senderaddress & vbNewLine & vbNewLine & objItem.Body

    objMail.To = emailAddress
    objMail.Subject = objItem.Subject
    objMail.Body = strbody

    ' remove the comment from below to display the message before sending
    'objMail.Display

    'Automatically Send the ticket
    objMail.Send

    Set objItem = Nothing
    Set objMail = Nothing
    End Sub

    Function GetCurrentItem() As Object
    Dim objApp As Outlook.Application
    Set objApp = Application
    On Error Resume Next
    Select Case TypeName(objApp.ActiveWindow)
    Case "Explorer"
    Set GetCurrentItem = _
    objApp.ActiveExplorer.Selection.Item(1)
    Case "Inspector"
    Set GetCurrentItem = _
    objApp.ActiveInspector.CurrentItem
    Case Else
    End Select
    End Function

  • STEP 2: Add a Group on the main Ribbon for the button
  1. On main ribbon, right click and select 'Customize the Ribbon...'
  2. In the popup opened, three panels will be shown. In the right most panel:
    1. select the tab you want to add this button in
    2. Press 'New Group'
    3. Press 'Rename' to set appropriate name for your new button
    4. From middle panel, select 'Macro' in  'Choose commands from'
    5. Select your macro and add it to custom group you created above
    6. Following steps 2.2 and 2.3, rename your marco component too.
    7. Press Ok.
    8. The button you have added will be shown in ribbon. To forward any email, select the email and press this button.

 

Please contact us at support@ortooapps.com with any questions.

Was this information helpful?
Quick survey: How do you rate Email-to-anything?
★★★★★ - EXCELLENT
★★★★ - GOOD
★★★☆☆OK
★★☆☆☆POOR
☆☆☆☆ - RUBBISH

The page cannot be found

The page you are looking for might have been removed, had its name changed, or is temporarily unavailable. Please make sure you spelled the page name correctly or use the search box.

Support