Skip to main content

Kutools for Office — One Suite. Five Tools. Get More Done.

How to auto create a dear sender’s name when replying message in Outlook?

Author Xiaoyang Last modified

When replying to emails in Outlook, it's common to start with a polite greeting such as “Dear John,” followed by a message like “Good morning!” However, typing this manually every time can be tedious and time-consuming. This tutorial introduces two effective methods to automatically insert the sender’s name and greeting when replying to messages in Outlook:

Method 1: Automatically Add Greetings with VBA When Replying to Emails (Flexible but Manual Setup)

Method 2: Automatically Add Greeting When Replying or Forwarding with Kutools for Outlook 👍 (Quick & Easy)


Method 1: Automatically Add Greetings with VBA When Replying to Emails

The following VBA code helps you auto-insert a personalized greeting (e.g., "Dear John, Good morning!") into the reply message body based on the current time of day.

Step 1: Open the VBA Editor in Outlook

1. Press Alt + F11 to open the Microsoft Visual Basic for Applications window.

2. In the left pane under "Project1 (VbaProject.OTM)", expand "Microsoft Outlook Objects" and double-click "ThisOutlookSession".

Step 2: Insert the VBA Code

Copy and paste the following VBA code into the editor:

Public WithEvents GExplorer As Outlook.Explorer
Public WithEvents GMailItem As Outlook.MailItem

Private Sub Application_Startup()
    Set GExplorer = Outlook.Application.ActiveExplorer
End Sub

Private Sub GExplorer_SelectionChange()
    Dim xItem As Object
    On Error Resume Next
    Set xItem = GExplorer.Selection.Item(1)
    If xItem.Class <> olMail Then Exit Sub
    Set GMailItem = xItem
End Sub

Private Sub GMailItem_Reply(ByVal Response As Object, Cancel As Boolean)
    AutoAddGreetingToReply Response
End Sub

Private Sub GMailItem_ReplyAll(ByVal Response As Object, Cancel As Boolean)
    AutoAddGreetingToReply Response
End Sub

Sub AutoAddGreetingToReply(Item As Object)
    Dim xGreetStr As String
    Dim xReplyMail As MailItem
    Dim xSenderName As String
    Dim xRecipient As Recipient
    On Error Resume Next
    If Item.Class <> olMail Then Exit Sub
    Set xReplyMail = Item
    For Each xRecipient In xReplyMail.Recipients
        If xSenderName = "" Then
            xSenderName = xRecipient.Name
        Else
            xSenderName = xSenderName & "," & xRecipient.Name
        End If
    Next xRecipient
    Select Case Time
           Case 0.3 To 0.5
                xGreetStr = " Good morning!"
           Case 0.5 To 0.75
                xGreetStr = " Good afternoon!"
           Case Else
                xGreetStr = " Good evening!"
    End Select
    With xReplyMail
        .Display
        .HTMLBody = "Dear " & xSenderName & "," & xGreetStr & "" & .HTMLBody
    End With
End Sub

doc-auto-dear-sender-name-1

Step 3: Save VBA Code and Restart Outlook

1. Press Ctrl + S to save the project.

2. Close the VBA editor and restart Outlook for the code to take effect.

Result:

Whenever you reply to an email, Outlook will automatically insert a greeting at the top of the message body.

shot of a greeting at the top of the message body

Limitations of the VBA Method:

  • ❌ Manual Setup Required : You must access and edit the VBA editor.
  • ❌ Macros Must Be Enabled: Some Outlook environments may block macros.
  • ❌ Basic Formatting: The greeting style is limited unless you modify the code further.

📅 Auto-Insert Date and Text in Subject or Signature Instantly!

Tired of manually adding dates to emails? With Kutools for Outlook, you can automatically insert the current date—and even custom text—into your email subject or signature every time you create, reply to, or forward a message. Just set it once, and Kutools handles it for you—instantly and consistently. 🚀

💡 Quick Tip: Click Kutools > Options, then enable date insertion in subjects or signatures.

Auto Insert Date into Subject or Signature
Auto-insert date in signatures
Auto-add date to subject lines
Custom date format
Works on new & reply emails

Method 2: Automatically Add Greeting When Replying or Forwarding with Kutools for Outlook 👍

If you want a faster, code-free approach, "Kutools for Outlook" provides a built-in Greeting feature that automatically adds the sender’s name with a greeting when replying or forwarding emails.

Say goodbye to Outlook inefficiency! Kutools for Outlook makes batch email processing easier - now with free AI-powered features! Download Kutools for Outlook Now!!

1. Click "Kutools" > "Options" to open the "Options" dialog box..

shot of the Options button

2. In the "Options" dialog, configure the following:

  1. 1). Go to the "Reply" tab.
  2. 2). Check the "Add greeting when create, reply to and forward an email" option. By default, it will show Hi <<SenderName>>,  in the box.
  3. ⚡ Tip: You can replace the greeting with your own text and customize it using automatic name codes like <<FirstName>>, <<LastName>>, or <<SenderName>> to insert the recipient’s name as needed.
  4. 3). Click OK to save the settings.

shot of the Options dialog

📌 Result: From now on, every time you reply or forward an email, Kutools will automatically insert a greeting at the beginning of the message body.

shot of a greeting at the beginning of the message body

Advantages of the Kutools for Outlook Method:

  • No Coding Required: Enable it with just a few clicks.
  • Fully Customizable: Use different placeholders and greeting styles.
  • Works for Replies and Forwards: Auto-applies to both.
  • Faster Workflow: Saves time with zero setup effort after enabling.

Which Method Should You Use?

Here’s a quick comparison of the two methods to help you choose the best fit for your needs:

MethodBest ForEase of UseSetup TimeFlexibility
Method 1: VBA Users who need a customized, script-based solution ⭐⭐ ⏳ Long ⭐⭐⭐⭐
Method 2: Kutools for Outlook Users who want a quick, code-free experience ⭐⭐⭐⭐⭐ ⚡ Fast ⭐⭐⭐⭐⭐

Final Recommendation:
If you're comfortable with VBA and need advanced control over the greeting content, Method 1 is a solid choice. But for most users, Method 2 with Kutools for Outlook is the easiest and most efficient way to add greetings automatically with minimal setup and zero coding.


Best Office Productivity Tools

Breaking News: Kutools for Outlook Launches Free Version!

Experience the all-new Kutools for Outlook with 100+ incredible features! Click to download now!

🤖 Kutools AI : Uses advanced AI technology to handle emails effortlessly, including replying, summarizing, optimizing, extending, translating, and composing emails.

📧 Email Automation: Auto Reply (Available for POP and IMAP)  /  Schedule Send Emails  /  Auto CC/BCC by Rules When Sending Email  /  Auto Forward (Advanced Rules)   /  Auto Add Greeting   /  Automatically Split Multi-Recipient Emails into Individual Messages ...

📨 Email Management: Recall Emails  /  Block Scam Emails by Subjects and Others  /  Delete Duplicate Emails  /  Advanced Search  /  Consolidate Folders ...

📁 Attachments ProBatch Save  /  Batch Detach  /  Batch Compress  /  Auto Save   /  Auto Detach  /  Auto Compress ...

🌟 Interface Magic: 😊More Pretty and Cool Emojis   /  Remind you when important emails come  /  Minimize Outlook Instead of Closing ...

👍 One-click Wonders: Reply All with Attachments  /   Anti-Phishing Emails  /  🕘Show Sender's Time Zone ...

👩🏼‍🤝‍👩🏻 Contacts & Calendar: Batch Add Contacts From Selected Emails  /  Split a Contact Group to Individual Groups  /  Remove Birthday Reminders ...

Use Kutools in your preferred language – supports English, Spanish, German, French, Chinese, and 40+ others!

Instantly unlock Kutools for Outlook with a single click. Don't wait, download now and boost your efficiency!

kutools for outlook features1 kutools for outlook features2

🚀 One-Click Download — Get All Office Add-ins

Strongly Recommended: Kutools for Office (5-in-1)

One click to download five installers at once — Kutools for Excel, Outlook, Word, PowerPoint and Office Tab Pro. Click to download now!

  • One-click convenience: Download all five setup packages in a single action.
  • 🚀 Ready for any Office task: Install the add-ins you need, when you need them.
  • 🧰 Included: Kutools for Excel / Kutools for Outlook / Kutools for Word / Office Tab Pro / Kutools for PowerPoint