Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #108985 > unrolled thread

Setting Return-Path in email

Started byragav s <raxmic@gmail.com>
First post2016-05-23 01:39 -0700
Last post2016-05-24 09:23 +0200
Articles 3 — 3 participants

Back to article view | Back to comp.lang.python


Contents

  Setting Return-Path in email ragav s <raxmic@gmail.com> - 2016-05-23 01:39 -0700
    Re: Setting Return-Path in email Vincent Vande Vyvre <vincent.vande.vyvre@telenet.be> - 2016-05-23 11:11 +0200
    Re: Setting Return-Path in email dieter <dieter@handshake.de> - 2016-05-24 09:23 +0200

#108985 — Setting Return-Path in email

Fromragav s <raxmic@gmail.com>
Date2016-05-23 01:39 -0700
SubjectSetting Return-Path in email
Message-ID<69c455ff-0fbd-42a5-a3fb-4ad0b89ed48e@googlegroups.com>
Hi all,

How can i add different Return-path and fromid in python.i have pasted the below code for preview


def sendMail(sub,fromid,to,cc,html):
    msg = MIMEMultipart('alternative')
    msg['Subject'] = sub
    msg['From'] = fromid
    msg['To'] = to
    toaddress = [to]
    if cc:
        msg['Cc'] = cc
        toaddress = to+","+ cc
        toaddress = toaddress.split(",")

    type = 'plain'
    part = MIMEText(html, type,'utf-8')
    msg.attach(part)

    s = smtplib.SMTP('localhost')
    s.sendmail(fromid,toaddress, msg.as_string())
    s.quit()

[toc] | [next] | [standalone]


#108986

FromVincent Vande Vyvre <vincent.vande.vyvre@telenet.be>
Date2016-05-23 11:11 +0200
Message-ID<mailman.14.1463995169.20402.python-list@python.org>
In reply to#108985
Le 23/05/2016 10:39, ragav s a écrit :
> Hi all,
>
> How can i add different Return-path and fromid in python.i have pasted the below code for preview
>
>
> def sendMail(sub,fromid,to,cc,html):
>      msg = MIMEMultipart('alternative')
>      msg['Subject'] = sub
>      msg['From'] = fromid
>      msg['To'] = to
>      toaddress = [to]
>      if cc:
>          msg['Cc'] = cc
>          toaddress = to+","+ cc
>          toaddress = toaddress.split(",")
>
>      type = 'plain'
>      part = MIMEText(html, type,'utf-8')
>      msg.attach(part)
>
>      s = smtplib.SMTP('localhost')
>      s.sendmail(fromid,toaddress, msg.as_string())
>      s.quit()


Try with
msg['Reply-To'] = the adress

Vincent

[toc] | [prev] | [next] | [standalone]


#109047

Fromdieter <dieter@handshake.de>
Date2016-05-24 09:23 +0200
Message-ID<mailman.47.1464074614.20402.python-list@python.org>
In reply to#108985
ragav s <raxmic@gmail.com> writes:
> How can i add different Return-path and fromid in python.i have pasted the below code for preview

Note that there are two different return paths associated with an
email exchange: one on the protocol level (SMPT - RFC821);
the other at the message level.

The one on the protocol level is used for reports about delivery
problems; the one at the message level is used for replies.

You specify the protocol level return path as "from_addr" in your
call to "smpt.sendmail". The message level return path is
usually defined by the "from:" message header and can be overridden
by the "reply-to" message header.

[toc] | [prev] | [standalone]


Back to top | Article view | comp.lang.python


csiph-web