Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 5941065
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T16:03:28+00:00 2026-05-22T16:03:28+00:00

I am using Python email and smtplib to send an email from Python. I

  • 0

I am using Python email and smtplib to send an email from Python. I am doing this via the Gmail SMTP server using my Gmail credentials. This works fine, however I would like to specify a Reply-to email address different from the from address, so that replies go to a separate address (non-Gmail.)

I have tried creating a reply to parameter like this:

   msg = MIMEMultipart()

   msg['From'] = "email@gmail.com"
   msg['To'] = to
   msg['Subject'] = subject
   msg['Reply-to'] = "email2@example.com"

But this doesn’t work. Can’t find any info on this in the Python docs.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-22T16:03:29+00:00Added an answer on May 22, 2026 at 4:03 pm

    Here’s my take on it. I believe that the "Reply-To" header should be set explicitly. The likely reason is that it’s less commonly used than headers such as "Subject", "To", and "From".

    python
    Python 2.6.6 (r266:84292, May 10 2011, 11:07:28)
    [GCC 4.2.1 (Apple Inc. build 5666) (dot 3)] on darwin
    Type "help", "copyright", "credits" or "license" for more information.
    >>> MAIL_SERVER = 'smtp.domain.example'
    >>> TO_ADDRESS = 'you@gmail.com'
    >>> FROM_ADDRESS = 'email@domain.example'
    >>> REPLY_TO_ADDRESS = 'email2@domain2.example'
    >>> import smtplib
    >>> import email.mime.multipart
    >>> msg = email.mime.multipart.MIMEMultipart()
    >>> msg['to'] = TO_ADDRESS
    >>> msg['from'] = FROM_ADDRESS
    >>> msg['subject'] = 'testing reply-to header'
    >>> msg.add_header('reply-to', REPLY_TO_ADDRESS)
    >>> server = smtplib.SMTP(MAIL_SERVER)
    >>> server.sendmail(msg['from'], [msg['to']], msg.as_string())
    {}
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to send an email (through gmail) using python script that someone
How to send HTML content in email using Python? I can send simple texts.
I've writted a Python script to send emails via a relay server. I've tested
I want to send an email with an attachment using the following code (Python
I want to write a program that sends email using Python's smtplib . I
Anyone know how to send an email using google wave python api? Thanks
I am using python smtplib and xoauth and I am trying to send an
This is effectively how i'm using _mssql. Everything works fine, even after i use
So I am trying to send out an email using this template and using
I'm having a problem emailing unicode characters using smtplib in Python 3. This fails

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.