Python论坛  - 讨论区

标题:[python-chinese] 右键菜单发送到 Gmail?

2006年07月07日 星期五 13:32

HoLin holin.he at gmail.com
Fri Jul 7 13:32:29 HKT 2006

由于我把一些东西保存到gmail备份,所有很想在某个文件上右键,然后选择发送到gmail。
刚才打算用python写一个发带附件邮件的脚本,可发送的时候总是验证失败,但foxmail却正常发送。
代码是这样的:

#coding=utf-8
from email.MIMEText import MIMEText
from email.MIMEMultipart import MIMEMultipart
from email.Header import Header
import smtplib, base64, sys

msg=MIMEMultipart() #支持附件
txt1=MIMEText('邮件正文',_subtype='plain',_charset='utf-8')
txt1.replace_header('Content-Transfer-Encoding', 'quoted-printable')
#否则邮件原文看不懂,但并不影响读信
msg.attach(txt1)

txt2=base64.encodestring(open('X.jpg','rb').read())
txt2=MIMEText(txt2)
txt2.replace_header('Content-Type', 'application/octet-stream; name="%s"' %
Header('中文f附件名测试test.rar','utf-8'))
txt2.add_header('Content-Disposition', 'attachment;filename="%s"' % Header('
中文附件名测试test.rar','utf-8') )
msg.attach(txt2)

msg['subject']=Header('中文邮件名测试test!(含附件)', 'utf-8')
msg['from']='holinhe at 163.com'
msg['to']='holinhe at 163.com'

fromaddr='holinhe at 163.com'
toaddrs=['holin.he at gmail.com']

server = smtplib.SMTP('smtp.163.com')
server.login('holinhe','xxx')
server.sendmail(fromaddr,toaddrs,msg.as_string())

--------------------------------

有没有人碰到过这个问题?

还有发送到gmail到功能,大家觉得如何阿?
-- 
Regards
HoLin
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.exoweb.net/pipermail/python-chinese/attachments/20060707/00c3cf48/attachment.html

[导入自Mailman归档:http://www.zeuux.org/pipermail/zeuux-python]

2006年07月07日 星期五 13:51

一只小蚂蚁 qixiangnj at gmail.com
Fri Jul 7 13:51:42 HKT 2006

这个功能倒是不错!
赞!


在06-7-7,HoLin <holin.he at gmail.com> 写道:
>
>  由于我把一些东西保存到gmail备份,所有很想在某个文件上右键,然后选择发送到gmail。
> 刚才打算用python写一个发带附件邮件的脚本,可发送的时候总是验证失败,但foxmail却正常发送。
> 代码是这样的:
>
> #coding=utf-8
> from email.MIMEText import MIMEText
> from email.MIMEMultipart import MIMEMultipart
> from email.Header import Header
> import smtplib, base64, sys
>
> msg=MIMEMultipart() #支持附件
> txt1=MIMEText('邮件正文',_subtype='plain',_charset='utf-8')
> txt1.replace_header('Content-Transfer-Encoding', 'quoted-printable')
> #否则邮件原文看不懂,但并不影响读信
> msg.attach(txt1)
>
> txt2=base64.encodestring(open('X.jpg','rb').read())
> txt2=MIMEText(txt2)
> txt2.replace_header('Content-Type', 'application/octet-stream; name="%s"'
> % Header('中文f附件名测试test.rar','utf-8'))
> txt2.add_header ('Content-Disposition', 'attachment;filename="%s"' %
> Header('中文附件名测试test.rar','utf-8') )
> msg.attach(txt2)
>
> msg['subject']=Header('中文邮件名测试test!(含附件)', 'utf-8')
> msg['from']='holinhe at 163.com'
> msg['to']='holinhe at 163.com'
>
> fromaddr='holinhe at 163.com'
> toaddrs=['holin.he at gmail.com']
>
> server = smtplib.SMTP('smtp.163.com')
> server.login('holinhe','xxx')
> server.sendmail(fromaddr,toaddrs,msg.as_string())
>
> --------------------------------
>
> 有没有人碰到过这个问题?
>
> 还有发送到gmail到功能,大家觉得如何阿?
> --
> Regards
> HoLin
>
> _______________________________________________
> python-chinese
> Post: send python-chinese at lists.python.cn
> Subscribe: send subscribe to python-chinese-request at lists.python.cn
> Unsubscribe: send unsubscribe to  python-chinese-request at lists.python.cn
> Detail Info: http://python.cn/mailman/listinfo/python-chinese
>
>


-- 
『忙忙碌碌   ★   碌碌无为』

――――一只小蚂蚁――――
http://blog.csdn.net/qixiang_nj

Tel:13851402330
QQ:375621797
MSN:qixiangnj at gmail.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.exoweb.net/pipermail/python-chinese/attachments/20060707/7ea1626d/attachment.htm

[导入自Mailman归档:http://www.zeuux.org/pipermail/zeuux-python]

2006年07月07日 星期五 14:52

Bruce Wang number5 at gmail.com
Fri Jul 7 14:52:28 HKT 2006

On 7/7/06, HoLin <holin.he at gmail.com> wrote:
>
> 由于我把一些东西保存到gmail备份,所有很想在某个文件上右键,然后选择发送到gmail。
> 刚才打算用python写一个发带附件邮件的脚本,可发送的时候总是验证失败,但foxmail却正常发送。
> 代码是这样的:
>
> #coding=utf-8
> from email.MIMEText import MIMEText
> from email.MIMEMultipart import MIMEMultipart
> from email.Header import Header
> import smtplib, base64, sys
>
> msg=MIMEMultipart() #支持附件
> txt1=MIMEText('邮件正文',_subtype='plain',_charset='utf-8')
> txt1.replace_header('Content-Transfer-Encoding', 'quoted-printable')
> #否则邮件原文看不懂,但并不影响读信
> msg.attach(txt1)
>

出什么错?




-- 
simple is good
http://brucewang.net
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.exoweb.net/pipermail/python-chinese/attachments/20060707/00b01be2/attachment.htm

[导入自Mailman归档:http://www.zeuux.org/pipermail/zeuux-python]

2006年07月07日 星期五 14:59

HoLin holin.he at gmail.com
Fri Jul 7 14:59:35 HKT 2006

On 7/7/06, Bruce Wang <number5 at gmail.com> wrote:
>
>
>
>  On 7/7/06, HoLin <holin.he at gmail.com> wrote:
> >
> >  由于我把一些东西保存到gmail备份,所有很想在某个文件上右键,然后选择发送到gmail。
> > 刚才打算用python写一个发带附件邮件的脚本,可发送的时候总是验证失败,但foxmail却正常发送。
> > 代码是这样的:
> >
> > #coding=utf-8
> > from email.MIMEText import MIMEText
> > from email.MIMEMultipart import MIMEMultipart
> > from email.Header import Header
> > import smtplib, base64, sys
> >
> > msg=MIMEMultipart() #支持附件
> > txt1=MIMEText('邮件正文',_subtype='plain',_charset='utf-8')
> > txt1.replace_header('Content-Transfer-Encoding', 'quoted-printable')
> > #否则邮件原文看不懂,但并不影响读信
> > msg.attach(txt1)
> >
>
> 出什么错?
>

    raise SMTPAuthenticationError(code, resp)
smtplib.SMTPAuthenticationError: (535, 'Error: authentication failed')

在网上查到这个
http://blog.czug.org/panjy/2006/6/dui163youxiangdezhichi

结果按上面的方法还是出错.
唉.打击.


 --
> simple is good
> http://brucewang.net
>
> _______________________________________________
> python-chinese
> Post: send python-chinese at lists.python.cn
> Subscribe: send subscribe to python-chinese-request at lists.python.cn
> Unsubscribe: send unsubscribe to  python-chinese-request at lists.python.cn
> Detail Info: http://python.cn/mailman/listinfo/python-chinese
>
>


-- 
Regards
HoLin
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.exoweb.net/pipermail/python-chinese/attachments/20060707/eb8708f8/attachment.html

[导入自Mailman归档:http://www.zeuux.org/pipermail/zeuux-python]

2006年07月07日 星期五 15:08

Bruce Wang number5 at gmail.com
Fri Jul 7 15:08:50 HKT 2006

On 7/7/06, HoLin <holin.he at gmail.com> wrote:
>
>
>
> On 7/7/06, Bruce Wang <number5 at gmail.com> wrote:
> >
> >
> >
> >  On 7/7/06, HoLin <holin.he at gmail.com > wrote:
> > >
> > >  由于我把一些东西保存到gmail备份,所有很想在某个文件上右键,然后选择发送到gmail。
> > > 刚才打算用python写一个发带附件邮件的脚本,可发送的时候总是验证失败,但foxmail却正常发送。
> > > 代码是这样的:
> > >
> > > #coding=utf-8
> > > from email.MIMEText import MIMEText
> > > from email.MIMEMultipart import MIMEMultipart
> > > from email.Header import Header
> > > import smtplib, base64, sys
> > >
> > > msg=MIMEMultipart() #支持附件
> > > txt1=MIMEText('邮件正文',_subtype='plain',_charset='utf-8')
> > > txt1.replace_header('Content-Transfer-Encoding', 'quoted-printable')
> > > #否则邮件原文看不懂,但并不影响读信
> > > msg.attach(txt1)
> > >
> >
> > 出什么错?
> >
>
>     raise SMTPAuthenticationError(code, resp)
> smtplib.SMTPAuthenticationError: (535, 'Error: authentication failed')
>
> 在网上查到这个
> http://blog.czug.org/panjy/2006/6/dui163youxiangdezhichi
>
> 结果按上面的方法还是出错.
> 唉.打击.
>
>
>

你的SMTP 要求验证
看看这里,
http://mail.gnome.org/archives/evolution-list/2004-November/msg00320.html


-- 
simple is good
http://brucewang.net
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.exoweb.net/pipermail/python-chinese/attachments/20060707/857889cd/attachment-0001.htm

[导入自Mailman归档:http://www.zeuux.org/pipermail/zeuux-python]

2006年07月07日 星期五 15:34

netkiller openunix at 163.com
Fri Jul 7 15:34:35 HKT 2006

拿sniffer 嗅一下25.就知道那出问题了.
  ----- Original Message ----- 
  From: HoLin 
  To: python-chinese at lists.python.cn 
  Sent: Friday, July 07, 2006 1:32 PM
  Subject: [python-chinese] 右键菜单发送到 Gmail?


  由于我把一些东西保存到gmail备份,所有很想在某个文件上右键,然后选择发送到gmail。
  刚才打算用python写一个发带附件邮件的脚本,可发送的时候总是验证失败,但foxmail却正常发送。
  代码是这样的:
  #coding=utf-8
  from email.MIMEText import MIMEText
  from email.MIMEMultipart import MIMEMultipart
  from email.Header import Header
  import smtplib, base64, sys

  msg=MIMEMultipart() #支持附件
  txt1=MIMEText('邮件正文',_subtype='plain',_charset='utf-8')
  txt1.replace_header('Content-Transfer-Encoding', 'quoted-printable') #否则邮件原文看不懂,但并不影响读信
  msg.attach(txt1)

  txt2=base64.encodestring(open('X.jpg','rb').read())
  txt2=MIMEText(txt2)
  txt2.replace_header('Content-Type', 'application/octet-stream; name="%s"' % Header('中文f附件名测试test.rar','utf-8'))
  txt2.add_header ('Content-Disposition', 'attachment;filename="%s"' % Header('中文附件名测试test.rar','utf-8') )
  msg.attach(txt2)

  msg['subject']=Header('中文邮件名测试test!(含附件)', 'utf-8')
  msg['from']='holinhe at 163.com' 
  msg['to']='holinhe at 163.com' 

  fromaddr='holinhe at 163.com'
  toaddrs=['holin.he at gmail.com']

  server = smtplib.SMTP('smtp.163.com') 
  server.login('holinhe','xxx') 
  server.sendmail(fromaddr,toaddrs,msg.as_string())

  --------------------------------

  有没有人碰到过这个问题?

  还有发送到gmail到功能,大家觉得如何阿?

  -- 
  Regards
  HoLin 


------------------------------------------------------------------------------


  _______________________________________________
  python-chinese
  Post: send python-chinese at lists.python.cn
  Subscribe: send subscribe to python-chinese-request at lists.python.cn
  Unsubscribe: send unsubscribe to  python-chinese-request at lists.python.cn
  Detail Info: http://python.cn/mailman/listinfo/python-chinese
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.exoweb.net/pipermail/python-chinese/attachments/20060707/75a573b3/attachment.html

[导入自Mailman归档:http://www.zeuux.org/pipermail/zeuux-python]

2006年07月07日 星期五 16:07

sun baole sun_able at kinca.cn
Fri Jul 7 16:07:05 HKT 2006

An HTML attachment was scrubbed...
URL: http://lists.exoweb.net/pipermail/python-chinese/attachments/20060707/ceacb2d6/attachment.htm

[导入自Mailman归档:http://www.zeuux.org/pipermail/zeuux-python]

2006年07月07日 星期五 16:21

netkiller openunix at 163.com
Fri Jul 7 16:21:12 HKT 2006

SMTP认识常用有四种.
你要看看auth反回什么信息.然后依据认证访问产生base64 认证数据.
去我主页自已看.
Postfix 那个文章.SMTP认证那一节..写得详细.


"""
在server.login('holinhe','xxx') 前增加
server.esmtp_features["auth"]="LOGIN PLAIN"

或者用其他的SMTP服务器试试。
"""
  ----- Original Message ----- 
  From: sun baole 
  To: python-chinese at lists.python.cn 
  Sent: Friday, July 07, 2006 4:07 PM
  Subject: Re: [python-chinese] 右键菜单发送到 Gmail?


  netkiller 写道: 
    拿sniffer 嗅一下25.就知道那出问题了.
      ----- Original Message ----- 
      From: HoLin 
      To: python-chinese at lists.python.cn 
      Sent: Friday, July 07, 2006 1:32 PM
      Subject: [python-chinese] 右键菜单发送到 Gmail?


      由于我把一些东西保存到gmail备份,所有很想在某个文件上右键,然后选择发送到gmail。
      刚才打算用python写一个发带附件邮件的脚本,可发送的时候总是验证失败,但foxmail却正常发送。
      代码是这样的:
      #coding=utf-8
      from email.MIMEText import MIMEText
      from email.MIMEMultipart import MIMEMultipart
      from email.Header import Header
      import smtplib, base64, sys

      msg=MIMEMultipart() #支持附件
      txt1=MIMEText('邮件正文',_subtype='plain',_charset='utf-8')
      txt1.replace_header('Content-Transfer-Encoding', 'quoted-printable') #否则邮件原文看不懂,但并不影响读信
      msg.attach(txt1)

      txt2=base64.encodestring(open('X.jpg','rb').read())
      txt2=MIMEText(txt2)
      txt2.replace_header('Content-Type', 'application/octet-stream; name="%s"' % Header('中文f附件名测试test.rar','utf-8'))
      txt2.add_header ('Content-Disposition', 'attachment;filename="%s"' % Header('中文附件名测试test.rar','utf-8') )
      msg.attach(txt2)

      msg['subject']=Header('中文邮件名测试test!(含附件)', 'utf-8')
      msg['from']='holinhe at 163.com' 
      msg['to']='holinhe at 163.com' 

      fromaddr='holinhe at 163.com'
      toaddrs=['holin.he at gmail.com']

      server = smtplib.SMTP('smtp.163.com') 
      server.login('holinhe','xxx') 
      server.sendmail(fromaddr,toaddrs,msg.as_string())

      --------------------------------

      有没有人碰到过这个问题?

      还有发送到gmail到功能,大家觉得如何阿?

      -- 
      Regards
      HoLin 


--------------------------------------------------------------------------
      _______________________________________________
      python-chinese
      Post: send python-chinese at lists.python.cn
      Subscribe: send subscribe to python-chinese-request at lists.python.cn
      Unsubscribe: send unsubscribe to  python-chinese-request at lists.python.cn
      Detail Info: http://python.cn/mailman/listinfo/python-chinese
----------------------------------------------------------------------------
_______________________________________________
python-chinese
Post: send python-chinese at lists.python.cn
Subscribe: send subscribe to python-chinese-request at lists.python.cn
Unsubscribe: send unsubscribe to  python-chinese-request at lists.python.cn
Detail Info: http://python.cn/mailman/listinfo/python-chinese
  在server.login('holinhe','xxx') 前增加
  server.esmtp_features["auth"]="LOGIN PLAIN"

  或者用其他的SMTP服务器试试。



------------------------------------------------------------------------------


  _______________________________________________
  python-chinese
  Post: send python-chinese at lists.python.cn
  Subscribe: send subscribe to python-chinese-request at lists.python.cn
  Unsubscribe: send unsubscribe to  python-chinese-request at lists.python.cn
  Detail Info: http://python.cn/mailman/listinfo/python-chinese
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.exoweb.net/pipermail/python-chinese/attachments/20060707/9b1dc496/attachment-0001.html

[导入自Mailman归档:http://www.zeuux.org/pipermail/zeuux-python]

2006年07月07日 星期五 16:37

HoLin holin.he at gmail.com
Fri Jul 7 16:37:43 HKT 2006

On 7/7/06, netkiller <openunix at 163.com> wrote:
>
>  SMTP认识常用有四种.
> 你要看看auth反回什么信息.然后依据认证访问产生base64 认证数据.
> 去我主页自已看.
>

主页地址呢?

  Postfix 那个文章.SMTP认证那一节..写得详细.
>
>
> """
> 在server.login('holinhe','xxx') 前增加
> server.esmtp_features["auth"]="LOGIN PLAIN"
>
> 或者用其他的SMTP服务器试试。
> """
>
>  ----- Original Message -----
> *From:* sun baole <sun_able at kinca.cn>
> *To:* python-chinese at lists.python.cn
>  *Sent:* Friday, July 07, 2006 4:07 PM
> *Subject:* Re: [python-chinese] 右键菜单发送到 Gmail?
>
>
> netkiller 写道:
>
> 拿sniffer 嗅一下25.就知道那出问题了.
>
> ----- Original Message -----
> *From:* HoLin <holin.he at gmail.com>
> *To:* python-chinese at lists.python.cn
> *Sent:* Friday, July 07, 2006 1:32 PM
> *Subject:* [python-chinese] 右键菜单发送到 Gmail?
>
>
> 由于我把一些东西保存到gmail备份,所有很想在某个文件上右键,然后选择发送到gmail。
> 刚才打算用python写一个发带附件邮件的脚本,可发送的时候总是验证失败,但foxmail却正常发送。
> 代码是这样的:
>
> #coding=utf-8
> from email.MIMEText import MIMEText
> from email.MIMEMultipart import MIMEMultipart
> from email.Header import Header
> import smtplib, base64, sys
>
> msg=MIMEMultipart() #支持附件
> txt1=MIMEText('邮件正文',_subtype='plain',_charset='utf-8')
> txt1.replace_header('Content-Transfer-Encoding', 'quoted-printable')
> #否则邮件原文看不懂,但并不影响读信
> msg.attach(txt1)
>
> txt2=base64.encodestring(open('X.jpg','rb').read())
> txt2=MIMEText(txt2)
> txt2.replace_header('Content-Type', 'application/octet-stream; name="%s"'
> % Header('中文f附件名测试test.rar','utf-8'))
> txt2.add_header ('Content-Disposition', 'attachment;filename="%s"' %
> Header('中文附件名测试test.rar','utf-8') )
> msg.attach(txt2)
>
> msg['subject']=Header('中文邮件名测试test!(含附件)', 'utf-8')
> msg['from']='holinhe at 163.com'
> msg['to']='holinhe at 163.com'
>
> fromaddr='holinhe at 163.com' 27holinhe at 163.com%27>
> toaddrs=['holin.he at gmail.com']
>
> server = smtplib.SMTP('smtp.163.com')
> server.login('holinhe','xxx')
> server.sendmail(fromaddr,toaddrs,msg.as_string())
>
> --------------------------------
>
> 有没有人碰到过这个问题?
>
> 还有发送到gmail到功能,大家觉得如何阿?
> --
> Regards
> HoLin
>
> ------------------------------
> _______________________________________________
> python-chinese
> Post: send python-chinese at lists.python.cn
> Subscribe: send subscribe to python-chinese-request at lists.python.cn
> Unsubscribe: send unsubscribe to  python-chinese-request at lists.python.cn
> Detail Info: http://python.cn/mailman/listinfo/python-chinese
>
> ------------------------------
>
> _______________________________________________
> python-chinese
> Post: send python-chinese at lists.python.cn
> Subscribe: send subscribe to python-chinese-request at lists.python.cn
> Unsubscribe: send unsubscribe to  python-chinese-request at lists.python.cn
> Detail Info: http://python.cn/mailman/listinfo/python-chinese
>
>
> 在server.login('holinhe','xxx') 前增加
> server.esmtp_features["auth"]="LOGIN PLAIN"
>
> 或者用其他的SMTP服务器试试。
>
> ------------------------------
>
> _______________________________________________
> python-chinese
> Post: send python-chinese at lists.python.cn
> Subscribe: send subscribe to python-chinese-request at lists.python.cn
> Unsubscribe: send unsubscribe to  python-chinese-request at lists.python.cn
> Detail Info: http://python.cn/mailman/listinfo/python-chinese
>
>
> _______________________________________________
> python-chinese
> Post: send python-chinese at lists.python.cn
> Subscribe: send subscribe to python-chinese-request at lists.python.cn
> Unsubscribe: send unsubscribe to  python-chinese-request at lists.python.cn
> Detail Info: http://python.cn/mailman/listinfo/python-chinese
>
>


-- 
Regards
HoLin
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.exoweb.net/pipermail/python-chinese/attachments/20060707/aa6ac2d8/attachment.html

[导入自Mailman归档:http://www.zeuux.org/pipermail/zeuux-python]

2006年07月07日 星期五 16:39

HoLin holin.he at gmail.com
Fri Jul 7 16:39:43 HKT 2006

On 7/7/06, Bruce Wang <number5 at gmail.com> wrote:

>
>
> On 7/7/06, HoLin <holin.he at gmail.com> wrote:
> >
> >
> >
> >  On 7/7/06, Bruce Wang < number5 at gmail.com> wrote:
> > >
> > >
> > >
> > >  On 7/7/06, HoLin <holin.he at gmail.com > wrote:
> > > >
> > > >  由于我把一些东西保存到gmail备份,所有很想在某个文件上右键,然后选择发送到gmail。
> > > > 刚才打算用python写一个发带附件邮件的脚本,可发送的时候总是验证失败,但foxmail却正常发送。
> > > > 代码是这样的:
> > > >
> > > > #coding=utf-8
> > > > from email.MIMEText import MIMEText
> > > > from email.MIMEMultipart import MIMEMultipart
> > > > from email.Header import Header
> > > > import smtplib, base64, sys
> > > >
> > > > msg=MIMEMultipart() #支持附件
> > > > txt1=MIMEText('邮件正文',_subtype='plain',_charset='utf-8')
> > > > txt1.replace_header('Content-Transfer-Encoding', 'quoted-printable')
> > > > #否则邮件原文看不懂,但并不影响读信
> > > > msg.attach(txt1)
> > > >
> > >
> > > 出什么错?
> > >
> >
> >      raise SMTPAuthenticationError(code, resp)
> > smtplib.SMTPAuthenticationError: (535, 'Error: authentication failed')
> >
> > 在网上查到这个
> > http://blog.czug.org/panjy/2006/6/dui163youxiangdezhichi
> >
> > 结果按上面的方法还是出错.
> > 唉.打击.
> >
> >
> >
>
> 你的SMTP 要求验证
> 看看这里,
> http://mail.gnome.org/archives/evolution-list/2004-November/msg00320.html
>

按这里的试了下还是有问题。
我把代码改成

#coding=utf-8
from email.MIMEText import MIMEText
from email.MIMEMultipart import MIMEMultipart
from email.Header import Header
import smtplib, base64, sys, smtpd, asyncore

#
msg=MIMEMultipart() #支持附件
txt1=MIMEText('邮件正文',_subtype='plain',_charset='utf-8')
txt1.replace_header('Content-Transfer-Encoding', 'quoted-printable')
#否则邮件原文看不懂,但并不影响读信
msg.attach(txt1)

txt2=base64.encodestring(open('X.jpg','rb').read())
txt2=MIMEText(txt2)
txt2.replace_header('Content-Type', 'application/octet-stream; name="%s"' %
Header('中文f附件名测试test.rar','utf-8'))
txt2.add_header('Content-Disposition', 'attachment;filename="%s"' % Header('
中文附件名测试test.rar','utf-8') )
msg.attach(txt2)

msg['subject']=Header('中文邮件名测试test!(含附件)', 'utf-8')
msg['from']='holin.he at gmail.com'
msg['to']='holin.he at gmail.com'

fromaddr='holin.he at gmail.com'
toaddrs=['holin.he at gmail.com']

server = smtplib.SMTP('smtp.gmail.com',587)
#server.esmtp_features["auth"]="LOGIN"
server.ehlo()
server.starttls()
server.ehlo()
server.login('holin.he at gmail.com','xxx')
server.sendmail(fromaddr,toaddrs,msg.as_string())
server.quit()
--------------

报这样的错误:
Traceback (most recent call last):
  File "C:\t.py", line 29, in ?
    server.starttls()
  File "D:\Python24\lib\smtplib.py", line 601, in starttls
    sslobj = socket.ssl(self.sock, keyfile, certfile)
AttributeError: 'module' object has no attribute 'ssl'



> --
> simple is good
> http://brucewang.net
>
> _______________________________________________
> python-chinese
> Post: send python-chinese at lists.python.cn
> Subscribe: send subscribe to python-chinese-request at lists.python.cn
> Unsubscribe: send unsubscribe to  python-chinese-request at lists.python.cn
> Detail Info: http://python.cn/mailman/listinfo/python-chinese
>
>


-- 
Regards
HoLin
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.exoweb.net/pipermail/python-chinese/attachments/20060707/2755d49f/attachment.html

[导入自Mailman归档:http://www.zeuux.org/pipermail/zeuux-python]

2006年07月07日 星期五 17:11

Bruce Wang number5 at gmail.com
Fri Jul 7 17:11:44 HKT 2006

On 7/7/06, HoLin <holin.he at gmail.com> wrote:
>
>
>
> On 7/7/06, Bruce Wang <number5 at gmail.com> wrote:
>
> >
> >
> > On 7/7/06, HoLin <holin.he at gmail.com> wrote:
> > >
> > >
> > >
> > >  On 7/7/06, Bruce Wang < number5 at gmail.com > wrote:
> > > >
> > > >
> > > >
> > > >
> 按这里的试了下还是有问题。
> 我把代码改成
>
> #coding=utf-8
> from email.MIMEText import MIMEText
> from email.MIMEMultipart import MIMEMultipart
> from email.Header import Header
> import smtplib, base64, sys, smtpd, asyncore
>
> #
> msg=MIMEMultipart() #支持附件
> txt1=MIMEText('邮件正文',_subtype='plain',_charset='utf-8')
> txt1.replace_header('Content-Transfer-Encoding', 'quoted-printable')
> #否则邮件原文看不懂,但并不影响读信
> msg.attach(txt1)
>
> txt2=base64.encodestring(open('X.jpg','rb').read())
> txt2=MIMEText(txt2)
> txt2.replace_header('Content-Type', 'application/octet-stream; name="%s"'
> % Header('中文f附件名测试test.rar','utf-8'))
> txt2.add_header ('Content-Disposition', 'attachment;filename="%s"' %
> Header('中文附件名测试test.rar','utf-8') )
> msg.attach(txt2)
>
> msg['subject']=Header('中文邮件名测试test!(含附件)', 'utf-8')
> msg['from']='holin.he at gmail.com'
> msg['to']='holin.he at gmail.com'
>
> fromaddr='holin.he at gmail.com' 27holin.he at gmail.com%27>
>
> toaddrs=['holin.he at gmail.com']
>
> server = smtplib.SMTP('smtp.gmail.com',587)
> #server.esmtp_features["auth"]="LOGIN"
> server.ehlo()
> server.starttls()
> server.ehlo()
> server.login( 'holin.he at gmail.com','xxx'<%27holin.he at gmail.com%27,%27xxx%27>)
>
>
> server.sendmail(fromaddr,toaddrs,msg.as_string())
> server.quit()
>
> --------------
>
> 报这样的错误:
> Traceback (most recent call last):
>   File "C:\t.py", line 29, in ?
>     server.starttls()
>   File "D:\Python24\lib\smtplib.py", line 601, in starttls
>     sslobj = socket.ssl(self.sock, keyfile, certfile)
> AttributeError: 'module' object has no attribute 'ssl'
>
>
>
> >
你的python是多少版本的,怎么不支持ssl, 去下载一个 2.4.3吧 http://www.python.org/download/


-- 
simple is good
http://brucewang.net
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.exoweb.net/pipermail/python-chinese/attachments/20060707/b78880a1/attachment-0001.html

[导入自Mailman归档:http://www.zeuux.org/pipermail/zeuux-python]

2006年07月07日 星期五 17:38

netkiller openunix at 163.com
Fri Jul 7 17:38:28 HKT 2006

主页是
http://netkiller.hikz.com


  ----- Original Message ----- 
  From: HoLin 
  To: python-chinese at lists.python.cn 
  Sent: Friday, July 07, 2006 4:37 PM
  Subject: Re: [python-chinese] 右键菜单发送到 Gmail?





  On 7/7/06, netkiller <openunix at 163.com> wrote: 
    SMTP认识常用有四种.
    你要看看auth反回什么信息.然后依据认证访问产生base64 认证数据.
    去我主页自已看.

  主页地址呢?


    Postfix 那个文章.SMTP认证那一节..写得详细.


    """
    在server.login('holinhe','xxx') 前增加
    server.esmtp_features["auth"]="LOGIN PLAIN"

    或者用其他的SMTP服务器试试。
    """
    ----- Original Message ----- 
    From: sun baole 
    To: python-chinese at lists.python.cn 
    Sent: Friday, July 07, 2006 4:07 PM
    Subject: Re: [python-chinese] 右键菜单发送到 Gmail?

     
    netkiller 写道: 
      拿sniffer 嗅一下25.就知道那出问题了.
        ----- Original Message ----- 
        From: HoLin 
        To: python-chinese at lists.python.cn 
        Sent: Friday, July 07, 2006 1:32 PM
        Subject: [python-chinese] 右键菜单发送到 Gmail?

         
        由于我把一些东西保存到gmail备份,所有很想在某个文件上右键,然后选择发送到gmail。
        刚才打算用python写一个发带附件邮件的脚本,可发送的时候总是验证失败,但foxmail却正常发送。
        代码是这样的:
        #coding=utf-8
        from email.MIMEText import MIMEText
        from email.MIMEMultipart import MIMEMultipart
        from email.Header import Header
        import smtplib, base64, sys

        msg=MIMEMultipart() #支持附件
        txt1=MIMEText('邮件正文',_subtype='plain',_charset='utf-8')
        txt1.replace_header('Content-Transfer-Encoding', 'quoted-printable') #否则邮件原文看不懂,但并不影响读信
        msg.attach(txt1)

        txt2=base64.encodestring(open('X.jpg','rb').read())
        txt2=MIMEText(txt2)
        txt2.replace_header('Content-Type', 'application/octet-stream; name="%s"' % Header('中文f附件名测试test.rar','utf-8'))
        txt2.add_header ('Content-Disposition', 'attachment;filename="%s"' % Header('中文附件名测试test.rar','utf-8') )
        msg.attach(txt2)

        msg['subject']=Header('中文邮件名测试test!(含附件)', 'utf-8')
        msg['from']='holinhe at 163.com' 
        msg['to']=' holinhe at 163.com' 

        fromaddr='holinhe at 163.com'
        toaddrs=[' holin.he at gmail.com']

        server = smtplib.SMTP('smtp.163.com') 
        server.login('holinhe','xxx') 
        server.sendmail(fromaddr,toaddrs,msg.as_string ())

        --------------------------------

        有没有人碰到过这个问题?

        还有发送到gmail到功能,大家觉得如何阿?

        -- 
        Regards
        HoLin 


------------------------------------------------------------------------
        _______________________________________________
        python-chinese
        Post: send python-chinese at lists.python.cn 
        Subscribe: send subscribe to python-chinese-request at lists.python.cn
        Unsubscribe: send unsubscribe to  python-chinese-request at lists.python.cn
        Detail Info: http://python.cn/mailman/listinfo/python-chinese
--------------------------------------------------------------------------
_______________________________________________
python-chinese
Post: send python-chinese at lists.python.cn
Subscribe: send subscribe to python-chinese-request at lists.python.cn
Unsubscribe: send unsubscribe to  python-chinese-request at lists.python.cn
Detail Info: http://python.cn/mailman/listinfo/python-chinese
    在server.login ('holinhe','xxx') 前增加
    server.esmtp_features["auth"]="LOGIN PLAIN"

    或者用其他的SMTP服务器试试。



----------------------------------------------------------------------------



    _______________________________________________
    python-chinese
    Post: send python-chinese at lists.python.cn 
    Subscribe: send subscribe to python-chinese-request at lists.python.cn
    Unsubscribe: send unsubscribe to  python-chinese-request at lists.python.cn
    Detail Info: http://python.cn/mailman/listinfo/python-chinese


    _______________________________________________
    python-chinese
    Post: send python-chinese at lists.python.cn
    Subscribe: send subscribe to python-chinese-request at lists.python.cn
    Unsubscribe: send unsubscribe to  python-chinese-request at lists.python.cn
    Detail Info: http://python.cn/mailman/listinfo/python-chinese





  -- 
  Regards
  HoLin 


------------------------------------------------------------------------------


  _______________________________________________
  python-chinese
  Post: send python-chinese at lists.python.cn
  Subscribe: send subscribe to python-chinese-request at lists.python.cn
  Unsubscribe: send unsubscribe to  python-chinese-request at lists.python.cn
  Detail Info: http://python.cn/mailman/listinfo/python-chinese
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.exoweb.net/pipermail/python-chinese/attachments/20060707/2bf92597/attachment.html

[导入自Mailman归档:http://www.zeuux.org/pipermail/zeuux-python]

2006年07月07日 星期五 20:47

Ocean Chen chocean at gmail.com
Fri Jul 7 20:47:28 HKT 2006

1. 给163发邮件需要修改smtplib.py 516行的AUTH_PLAIN = "PLAIN"为AUTH_PLAIN = "LOGIN
PLAIN"。是163的smtp不合标准的问题。
server.esmtp_features["auth"]="LOGIN PLAIN" 方法经验证无效

2. gmail的smtp似乎有问题,用foxmail经常收不了


在06-7-7,netkiller <openunix at 163.com> 写道:
>
>  主页是
> http://netkiller.hikz.com
>
>
>
> ----- Original Message -----
> *From:* HoLin <holin.he at gmail.com>
> *To:* python-chinese at lists.python.cn
> *Sent:* Friday, July 07, 2006 4:37 PM
> *Subject:* Re: [python-chinese] 右键菜单发送到 Gmail?
>
>
>
> On 7/7/06, netkiller <openunix at 163.com> wrote:
> >
> >  SMTP认识常用有四种.
> > 你要看看auth反回什么信息.然后依据认证访问产生base64 认证数据.
> > 去我主页自已看.
> >
>
> 主页地址呢?
>
>   Postfix 那个文章.SMTP认证那一节..写得详细.
> >
> >
> > """
> > 在server.login('holinhe','xxx') 前增加
> > server.esmtp_features["auth"]="LOGIN PLAIN"
> >
> > 或者用其他的SMTP服务器试试。
> > """
> >
> >  ----- Original Message -----
> > *From:* sun baole <sun_able at kinca.cn>
> > *To:* python-chinese at lists.python.cn <python-chinese at lists.python.cn+>
> >  *Sent:* Friday, July 07, 2006 4:07 PM
> > *Subject:* Re: [python-chinese] 右键菜单发送到 Gmail?
> >
> >
> > netkiller 写道:
> >
> > 拿sniffer 嗅一下25.就知道那出问题了.
> >
> > ----- Original Message -----
> > *From:* HoLin <holin.he at gmail.com>
> > *To:* python-chinese at lists.python.cn
> > *Sent:* Friday, July 07, 2006 1:32 PM
> > *Subject:* [python-chinese] 右键菜单发送到 Gmail?
> >
> >
> > 由于我把一些东西保存到gmail备份,所有很想在某个文件上右键,然后选择发送到gmail。
> > 刚才打算用python写一个发带附件邮件的脚本,可发送的时候总是验证失败,但foxmail却正常发送。
> > 代码是这样的:
> >
> > #coding=utf-8
> > from email.MIMEText import MIMEText
> > from email.MIMEMultipart import MIMEMultipart
> > from email.Header import Header
> > import smtplib, base64, sys
> >
> > msg=MIMEMultipart() #支持附件
> > txt1=MIMEText('邮件正文',_subtype='plain',_charset='utf-8')
> > txt1.replace_header('Content-Transfer-Encoding', 'quoted-printable')
> > #否则邮件原文看不懂,但并不影响读信
> > msg.attach(txt1)
> >
> > txt2=base64.encodestring(open('X.jpg','rb').read())
> > txt2=MIMEText(txt2)
> > txt2.replace_header('Content-Type', 'application/octet-stream;
> > name="%s"' % Header('中文f附件名测试test.rar','utf-8'))
> > txt2.add_header ('Content-Disposition', 'attachment;filename="%s"' %
> > Header('中文附件名测试test.rar','utf-8') )
> > msg.attach(txt2)
> >
> > msg['subject']=Header('中文邮件名测试test!(含附件)', 'utf-8')
> > msg['from']='holinhe at 163.com'
> > msg['to']=' holinhe at 163.com'
> >
> > fromaddr='holinhe at 163.com' 27holinhe at 163.com%27>
> > toaddrs=[' holin.he at gmail.com']
> >
> > server = smtplib.SMTP('smtp.163.com')
> > server.login('holinhe','xxx')
> > server.sendmail(fromaddr,toaddrs,msg.as_string ())
> >
> > --------------------------------
> >
> > 有没有人碰到过这个问题?
> >
> > 还有发送到gmail到功能,大家觉得如何阿?
> > --
> > Regards
> > HoLin
> >
> > ------------------------------
> > _______________________________________________
> > python-chinese
> > Post: send python-chinese at lists.python.cn
> > Subscribe: send subscribe to python-chinese-request at lists.python.cn
> > Unsubscribe: send unsubscribe to  python-chinese-request at lists.python.cn
> > Detail Info: http://python.cn/mailman/listinfo/python-chinese
> >
> > ------------------------------
> >
> > _______________________________________________
> > python-chinese
> > Post: send python-chinese at lists.python.cn
> > Subscribe: send subscribe to python-chinese-request at lists.python.cn
> > Unsubscribe: send unsubscribe to  python-chinese-request at lists.python.cn
> > Detail Info: http://python.cn/mailman/listinfo/python-chinese
> >
> >
> > 在server.login ('holinhe','xxx') 前增加
> > server.esmtp_features["auth"]="LOGIN PLAIN"
> >
> > 或者用其他的SMTP服务器试试。
> >
> > ------------------------------
> >
> >  _______________________________________________
> > python-chinese
> > Post: send python-chinese at lists.python.cn
> > Subscribe: send subscribe to python-chinese-request at lists.python.cn
> > Unsubscribe: send unsubscribe to  python-chinese-request at lists.python.cn
> > Detail Info: http://python.cn/mailman/listinfo/python-chinese
> >
> >
> > _______________________________________________
> > python-chinese
> > Post: send python-chinese at lists.python.cn
> > Subscribe: send subscribe to python-chinese-request at lists.python.cn
> > Unsubscribe: send unsubscribe to  python-chinese-request at lists.python.cn
> > Detail Info: http://python.cn/mailman/listinfo/python-chinese
> >
> >
>
>
> --
> Regards
> HoLin
>
> ------------------------------
>
> _______________________________________________
> python-chinese
> Post: send python-chinese at lists.python.cn
> Subscribe: send subscribe to python-chinese-request at lists.python.cn
> Unsubscribe: send unsubscribe to  python-chinese-request at lists.python.cn
> Detail Info: http://python.cn/mailman/listinfo/python-chinese
>
>
> _______________________________________________
> python-chinese
> Post: send python-chinese at lists.python.cn
> Subscribe: send subscribe to python-chinese-request at lists.python.cn
> Unsubscribe: send unsubscribe to  python-chinese-request at lists.python.cn
> Detail Info: http://python.cn/mailman/listinfo/python-chinese
>
>


-- 
Ocean
mail: chocean at gmail.com
homepage: www.oceanisland.com.cn
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.exoweb.net/pipermail/python-chinese/attachments/20060707/ab5344de/attachment-0001.htm

[导入自Mailman归档:http://www.zeuux.org/pipermail/zeuux-python]

如下红色区域有误,请重新填写。

    你的回复:

    请 登录 后回复。还没有在Zeuux哲思注册吗?现在 注册 !

    Zeuux © 2025

    京ICP备05028076号