[python-win32] Accessing standard Mail-application

Vernon Cole vernondcole at gmail.com
Mon Jul 11 17:58:55 CEST 2011


On Fri, Jul 8, 2011 at 3:23 PM, Steffen Frömer <
steffen.froemer at gns-systems.de> wrote:

>  On 07/08/2011 10:16 PM, Tim Roberts wrote:
>
> Steffen Frömer wrote:
>
>  i tried to access standard mail application to write a mail.
> I know the machanism with urllib, but there is no regular way to add
> attachments.
>
>  How would you do that with urllib?
>
>
>  However, to be completely general, you need to use smtplib to send to an
> external mail server.
>
>  This is no option, because there is noch smtp-server withouf
> authentication and we need to send mails from different users.
>
>  Regards,
> Steffen
>
> Steffen:
  You (who ever you mean when you say "we") should probably set up a
dedicated smtp-server for your group.  If many of your users have OUTLOOK,
then you may have an exchange server which could be used for that purpose.
In my own case, it was fairly easy to get that administrator to turn on smtp
support on the company's exchange server.  I wrote a little private
in-company-email module which was pre-programmed with the name of the
exchange server and with our company's authentication. The smtplib calls
were embedded within it.
  To add an attachment, you need MIME -- which was invented for that exact
purpose.  There is a whole library of python standard modules for doing
that.  See http://docs.python.org/library/email.html and an example in
http://code.activestate.com/recipes/52243-sending-multipart-mime-email-<http://code.activestate.com/recipes/52243-sending-multipart-mime-email-with-smtplib-and-mime/>
with-smtplib-and-mime/<http://code.activestate.com/recipes/52243-sending-multipart-mime-email-with-smtplib-and-mime/>

  That ought to be much easier than hacking OUTLOOK -- especially if you
must support version updates, etc.
--
Vernon
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-win32/attachments/20110711/5a309d63/attachment.html>


More information about the python-win32 mailing list