Sending e-mail from wxPython

Right, and that's really the right way to send e-mail from a program.
There is no reliably portable way to do what you want.

On Windows, you can often use COM to access MAPI. Many e-mail clients
install themselves as the default MAPI client, but not all. For clients
that are not MAPI compatible, which means 100% of the clients on Linux,
there is simply no way to do this in a generic way.

Sendmail is the right way to go. You can do a bcc to the user so they get
a copy, if you want. What bothers you about that approach?

···

On Wed, 12 Nov 2003 19:26:15 +0100, "Werner F. Bruhin" <werner.bruhin@free.fr> wrote:

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).

--
- Tim Roberts, timr@probo.com
  Providenza & Boekelheide, Inc.

Hi Tim,

Thanks for taking the time to respond.

Tim Roberts wrote:

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).
   
Right, and that's really the right way to send e-mail from a program. There is no reliably portable way to do what you want.

That is a real pity.

On Windows, you can often use COM to access MAPI. Many e-mail clients
install themselves as the default MAPI client, but not all. For clients
that are not MAPI compatible, which means 100% of the clients on Linux,
there is simply no way to do this in a generic way.

Sendmail is the right way to go. You can do a bcc to the user so they get
a copy, if you want. What bothers you about that approach?

- User has to be connected to his/her Internet provider (not everyone has broadband yet).
- User has to configure my application so that I know what his/her SMTP server is (unless there is some magic I can use to find this out - which I have not found yet) and with his/her e-mail address so I can CC or BCC.

I was playing around with MAPI but I don't like it for the same reasons you mention.

So, I guess I have to add these two configuration options, and get to grips with the email package and use sendmail.

···

On Wed, 12 Nov 2003 19:26:15 +0100, "Werner F. Bruhin" ><werner.bruhin@free.fr> wrote:

--
- Tim Roberts, timr@probo.com
Providenza & Boekelheide, Inc.

---------------------------------------------------------------------
To unsubscribe, e-mail: wxPython-users-unsubscribe@lists.wxwindows.org
For additional commands, e-mail: wxPython-users-help@lists.wxwindows.org

Tim Roberts wrote:
>>I like to add a function to be able to send an e-mail from within a
>>wxPyhton app.

[...]

>>With smtplib it does NOT go via the users mail client (unless I am
>>missing something).
>
>Right, and that's really the right way to send e-mail from a program.
>There is no reliably portable way to do what you want.
>
>
That is a real pity.

>On Windows, you can often use COM to access MAPI. Many e-mail clients
>install themselves as the default MAPI client, but not all. For clients
>that are not MAPI compatible, which means 100% of the clients on Linux,
>there is simply no way to do this in a generic way.
>
>Sendmail is the right way to go. You can do a bcc to the user so they get
>a copy, if you want. What bothers you about that approach?

- User has to be connected to his/her Internet provider (not everyone
has broadband yet).
- User has to configure my application so that I know what his/her SMTP
server is (unless there is some magic I can use to find this out - which
I have not found yet) and with his/her e-mail address so I can CC or
BCC.

[...]

So, I guess I have to add these two configuration options, and get to
grips with the email package and use sendmail.

I think that there's a misunderstanding--you don't have to add those
configuration-options.

He said `use sendmail', which, unless he mis-spoke, means "the unix
`mail' command", not `use smtplib'--the two are very different.

Neither of the two points that you've raised here are true and
applicable when using sendmail.

The `user needs to be connected' point is not applicable because you
can and should have faith that the user has its MTA configure however
is appropriate to its situation--this could mean that mail is sent
immediately, it could mean that mail is spooled locally and sent it
batches, it could mean that a dial-up connection is made on-demand, or
it could mean something else. I've encountered all of those
configurations.

The `user has to configure my application so that I know what his/her
SMTP server is' point is false, because the MTA (e.g.: sendmail) knows
that if it needs to. It may not even be true that the MTA needs to
send all of its mail to a specific SMTP-server--I have several systems
where the MTA looks up MX records for target-addresses' domains in DNS
and then delivers messages directly. In any case, this isn't something
that your application needs to know.

The `user needs to configure my application with his/her e-mail
address so I can CC or BCC' is also not true. The correct address to
which locally-generated mail should be sent, on a unix or unix-like
system, is to the user's local account--unix-like systems have a
provision for this; if mail for that user's account is supposed to go
somewhere else, then the system's MTA will forward it. So, all you
have to do here is look up the user's username.

Of course, if your applcation is interactive, it might be in good
taste if you prompted the user for confirmation of the addresses to
which the mail is to be sent, and if you let the user edit the
recipient-list.

There *is* a piece of what you want that just can't currently be done,
however:

What you really want is to create a message-object and then have the
system open it in the user's preferred message-editor/MUA, and then have
the MUA take if from there. There is no provision for doing this--even
if there is a way for you to determine the preferred MUA, there
doesn't appear to be any standard way to tell the MUA that it should
open a specific message for edit-and-whatever.

···

On Thu, Nov 13, 2003 at 11:32:16AM +0100, Werner F. Bruhin wrote:

>On Wed, 12 Nov 2003 19:26:15 +0100, "Werner F. Bruhin" > ><werner.bruhin@free.fr> wrote:

>--
>- Tim Roberts, timr@probo.com
> Providenza & Boekelheide, Inc.
>
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: wxPython-users-unsubscribe@lists.wxwindows.org
>For additional commands, e-mail: wxPython-users-help@lists.wxwindows.org
>
>
>
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: wxPython-users-unsubscribe@lists.wxwindows.org
For additional commands, e-mail: wxPython-users-help@lists.wxwindows.org

--
At some point, I suspect that I'm going to find myself reading
slashdot and have the same reaction as I did when I realised
that I was watching Pokemon.

Dear Joshua,

Thanks for taking the time to respond in so much detail.

sendmail sounds nice, BUT I am on Windows (and deploy on Windows at least initially) and by default sendmail is NOT present, so the option I have is really smtplib.sendmail which I guess means I will have to prompt the user for the info I need (and put it into his/her preferences for the next time round) and create some dialog so the user can see what will be sent out or cancel the process if he/she does not want it to go out.

See you
Werner

Joshua Judson Rosen wrote:

···

On Thu, Nov 13, 2003 at 11:32:16AM +0100, Werner F. Bruhin wrote:

Tim Roberts wrote:
   

On Wed, 12 Nov 2003 19:26:15 +0100, "Werner F. Bruhin" >>><werner.bruhin@free.fr> wrote:
     

I like to add a function to be able to send an e-mail from within a wxPyhton app.
       

[...]

With smtplib it does NOT go via the users mail client (unless I am missing something).
       

Right, and that's really the right way to send e-mail from a program. There is no reliably portable way to do what you want.

That is a real pity.

On Windows, you can often use COM to access MAPI. Many e-mail clients
install themselves as the default MAPI client, but not all. For clients
that are not MAPI compatible, which means 100% of the clients on Linux,
there is simply no way to do this in a generic way.

Sendmail is the right way to go. You can do a bcc to the user so they get
a copy, if you want. What bothers you about that approach?
     

- User has to be connected to his/her Internet provider (not everyone has broadband yet).
- User has to configure my application so that I know what his/her SMTP server is (unless there is some magic I can use to find this out - which I have not found yet) and with his/her e-mail address so I can CC or
BCC.
   

[...]

So, I guess I have to add these two configuration options, and get to grips with the email package and use sendmail.
   
I think that there's a misunderstanding--you don't have to add those
configuration-options.

He said `use sendmail', which, unless he mis-spoke, means "the unix
`mail' command", not `use smtplib'--the two are very different.

Neither of the two points that you've raised here are true and
applicable when using sendmail.

The `user needs to be connected' point is not applicable because you
can and should have faith that the user has its MTA configure however
is appropriate to its situation--this could mean that mail is sent
immediately, it could mean that mail is spooled locally and sent it
batches, it could mean that a dial-up connection is made on-demand, or
it could mean something else. I've encountered all of those
configurations.

The `user has to configure my application so that I know what his/her
SMTP server is' point is false, because the MTA (e.g.: sendmail) knows
that if it needs to. It may not even be true that the MTA needs to
send all of its mail to a specific SMTP-server--I have several systems
where the MTA looks up MX records for target-addresses' domains in DNS
and then delivers messages directly. In any case, this isn't something
that your application needs to know.

The `user needs to configure my application with his/her e-mail
address so I can CC or BCC' is also not true. The correct address to
which locally-generated mail should be sent, on a unix or unix-like
system, is to the user's local account--unix-like systems have a
provision for this; if mail for that user's account is supposed to go
somewhere else, then the system's MTA will forward it. So, all you
have to do here is look up the user's username.

Of course, if your applcation is interactive, it might be in good
taste if you prompted the user for confirmation of the addresses to
which the mail is to be sent, and if you let the user edit the
recipient-list.

There *is* a piece of what you want that just can't currently be done,
however:

What you really want is to create a message-object and then have the
system open it in the user's preferred message-editor/MUA, and then have
the MUA take if from there. There is no provision for doing this--even
if there is a way for you to determine the preferred MUA, there
doesn't appear to be any standard way to tell the MUA that it should
open a specific message for edit-and-whatever.

--
- Tim Roberts, timr@probo.com
Providenza & Boekelheide, Inc.

---------------------------------------------------------------------
To unsubscribe, e-mail: wxPython-users-unsubscribe@lists.wxwindows.org
For additional commands, e-mail: wxPython-users-help@lists.wxwindows.org

---------------------------------------------------------------------
To unsubscribe, e-mail: wxPython-users-unsubscribe@lists.wxwindows.org
For additional commands, e-mail: wxPython-users-help@lists.wxwindows.org