I like to add a function to be able to send an e-mail from within a wxPyhton app.
It should be possible to attach some files, have a text body, a number of to addresses and a subject line AND mail should be sent via whatever e-mail client the user uses (would be nice to be portable, but currently I would be happy with Windows XP, 2000 and possibly 98 support)
Played around both with "mailto" and smtplib, BUT don't get it to work as wanted.
With smtplib it does NOT go via the users mail client (unless I am missing something).
And the mailto\webbrowser approach (which goes via the email client) doesn't allow attachments and gives me problems when the text size of the "body" element is too big.
I also tried the new email package in python 2.3 to create a mime message but can't feed this to mailto.
So, I am at the stage where I hit my head against a wall so would very much appreciate other ideas, hints on how to go about this.
See you
Werner
"Werner F. Bruhin" <werner.bruhin@free.fr> wrote in message
news:3FB27B47.1050004@free.fr...
I like to add a function to be able to send an e-mail from within a
wxPyhton app.
It should be possible to attach some files, have a text body, a number
of to addresses and a subject line AND mail should be sent via whatever
e-mail client the user uses (would be nice to be portable, but currently
I would be happy with Windows XP, 2000 and possibly 98 support)
Played around both with "mailto" and smtplib, BUT don't get it to work
as wanted.
With smtplib it does NOT go via the users mail client (unless I am
missing something).
That's correct - are you suggesting that you *want* the mail to go via the
user's mail client? To do that, you would have to use some sort of
scripting to control the mail client, which would be highly dependant on the
mail client. It would be considered very abusive of the user's system, and
is a technique normally reserved for viruses and spammers.
···
And the mailto\webbrowser approach (which goes via the email client)
doesn't allow attachments and gives me problems when the text size of
the "body" element is too big.
I also tried the new email package in python 2.3 to create a mime
message but can't feed this to mailto.
So, I am at the stage where I hit my head against a wall so would very
much appreciate other ideas, hints on how to go about this.
See you
Werner
Hi David,
Thanks for taking the time to respond on this.
David Brown wrote:
"Werner F. Bruhin" <werner.bruhin@free.fr> wrote in message
news:3FB27B47.1050004@free.fr...
I like to add a function to be able to send an e-mail from within a
wxPyhton app.
It should be possible to attach some files, have a text body, a number
of to addresses and a subject line AND mail should be sent via whatever
e-mail client the user uses (would be nice to be portable, but currently
I would be happy with Windows XP, 2000 and possibly 98 support)
Played around both with "mailto" and smtplib, BUT don't get it to work
as wanted.
With smtplib it does NOT go via the users mail client (unless I am
missing something).
That's correct - are you suggesting that you *want* the mail to go via the
user's mail client? To do that, you would have to use some sort of
scripting to control the mail client, which would be highly dependant on the
mail client. It would be considered very abusive of the user's system, and
is a technique normally reserved for viruses and spammers.
What I like to get is the "mailto" functionality with the ability to
attach a file or two. This would allow the user to view/edit the mail,
he/she can decide NOT to send it at all, they can decide when to send it
(as still many people are on dial-up) AND archive what has been sent out.
I guess I could do most of this with smtplib, BUT the user would need to
configure my software with his/her smtp server address, it would NOT get
archived unless I CC the user (which is another configuration or entry
by the user) AND the user has to be on-line to his/her internet provider.
···
And the mailto\webbrowser approach (which goes via the email client)
doesn't allow attachments and gives me problems when the text size of
the "body" element is too big.
I also tried the new email package in python 2.3 to create a mime
message but can't feed this to mailto.
So, I am at the stage where I hit my head against a wall so would very
much appreciate other ideas, hints on how to go about this.
See you
Werner
---------------------------------------------------------------------
To unsubscribe, e-mail: wxPython-users-unsubscribe@lists.wxwindows.org
For additional commands, e-mail: wxPython-users-help@lists.wxwindows.org
In Wednesday, November 12, 2003, 3:26:15 PM, Werner wrote:
I like to add a function to be able to send an e-mail from within a
wxPyhton app. (...)
You could try to use something like the code below, replacing fn with
what you need according to the RFC2638, but note that this may not
work depending on the user's OS and default e-mail client installed.
fn = "mailto:your@mail.com?subject=Something"
ft = wxTheMimeTypesManager.GetFileTypeFromExtension("eml")
mime = ft.GetMimeType()
cmd = ft.GetOpenCommand(fn, mime)
if find(cmd,"#")<>-1:
cmd = '"%s" %s'%(split(split(cmd,"#")[1],'"')[1],filename)
self.process = wxProcess(self)
pid = wxExecute(cmd, wxEXEC_ASYNC, self.process)
self.process.Detach()
-- tacao