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


Groups > comp.lang.c++ > #40901 > unrolled thread

send email and socket programming

Started byalexo <alelvb@inwind.it>
First post2016-02-14 18:01 +0100
Last post2016-02-29 14:16 +0100
Articles 20 on this page of 57 — 14 participants

Back to article view | Back to comp.lang.c++


Contents

  send email and socket programming alexo <alelvb@inwind.it> - 2016-02-14 18:01 +0100
    Re: send email and socket programming JiiPee <no@notvalid.com> - 2016-02-14 17:07 +0000
      Re: send email and socket programming JiiPee <no@notvalid.com> - 2016-02-14 17:12 +0000
      Re: send email and socket programming alexo <alelvb@inwind.it> - 2016-02-14 19:44 +0100
    Re: send email and socket programming Paavo Helde <myfirstname@osa.pri.ee> - 2016-02-14 19:18 +0200
    Re: send email and socket programming Öö Tiib <ootiib@hot.ee> - 2016-02-14 09:39 -0800
      Re: send email and socket programming alexo <alelvb@inwind.it> - 2016-02-14 20:23 +0100
    Re: send email and socket programming woodbrian77@gmail.com - 2016-02-14 10:47 -0800
    Re: send email and socket programming Paavo Helde <myfirstname@osa.pri.ee> - 2016-02-14 21:19 +0200
      Re: send email and socket programming alexo <alelvb@inwind.it> - 2016-02-14 20:29 +0100
        Re: send email and socket programming Paavo Helde <myfirstname@osa.pri.ee> - 2016-02-14 22:29 +0200
          Re: send email and socket programming alexo <alelvb@inwind.it> - 2016-02-14 22:45 +0100
            Re: send email and socket programming Paavo Helde <myfirstname@osa.pri.ee> - 2016-02-15 00:15 +0200
              Re: send email and socket programming Paavo Helde <myfirstname@osa.pri.ee> - 2016-02-15 00:39 +0200
                Re: send email and socket programming Chris Vine <chris@cvine--nospam--.freeserve.co.uk> - 2016-02-14 23:01 +0000
                  Re: send email and socket programming Geoff <geoff@invalid.invalid> - 2016-02-14 15:22 -0800
                    Re: send email and socket programming Jerry Stuckle <jstucklex@attglobal.net> - 2016-02-14 18:41 -0500
                    Re: send email and socket programming Chris Vine <chris@cvine--nospam--.freeserve.co.uk> - 2016-02-14 23:43 +0000
                      Re: send email and socket programming Geoff <geoff@invalid.invalid> - 2016-02-14 17:33 -0800
                        Re: send email and socket programming Paavo Helde <myfirstname@osa.pri.ee> - 2016-02-15 09:37 +0200
                        Re: send email and socket programming Chris Vine <chris@cvine--nospam--.freeserve.co.uk> - 2016-02-15 10:04 +0000
                          Re: send email and socket programming Chris Vine <chris@cvine--nospam--.freeserve.co.uk> - 2016-02-15 10:14 +0000
                            Re: send email and socket programming Geoff <geoff@invalid.invalid> - 2016-02-15 10:11 -0800
            Re: send email and socket programming Geoff <geoff@invalid.invalid> - 2016-02-14 15:16 -0800
    Re: send email and socket programming Ian Collins <ian-news@hotmail.com> - 2016-02-15 08:40 +1300
      Re: send email and socket programming "Chris M. Thomasson" <nospam@nospam.nospam> - 2016-02-14 12:09 -0800
    Re: send email and socket programming Jerry Stuckle <jstucklex@attglobal.net> - 2016-02-14 16:04 -0500
    Re: send email and socket programming jt@toerring.de (Jens Thoms Toerring) - 2016-02-14 21:20 +0000
      Re: send email and socket programming alexo <alelvb@inwind.it> - 2016-02-14 22:40 +0100
        Re: send email and socket programming Chris Vine <chris@cvine--nospam--.freeserve.co.uk> - 2016-02-14 22:20 +0000
          Re: send email and socket programming Jerry Stuckle <jstucklex@attglobal.net> - 2016-02-14 18:01 -0500
            Re: send email and socket programming Ian Collins <ian-news@hotmail.com> - 2016-02-15 12:09 +1300
              Re: send email and socket programming Jerry Stuckle <jstucklex@attglobal.net> - 2016-02-14 18:37 -0500
                Re: send email and socket programming Ian Collins <ian-news@hotmail.com> - 2016-02-15 13:06 +1300
                  Re: send email and socket programming Jerry Stuckle <jstucklex@attglobal.net> - 2016-02-14 21:40 -0500
            Re: send email and socket programming Chris Vine <chris@cvine--nospam--.freeserve.co.uk> - 2016-02-14 23:35 +0000
              Re: send email and socket programming Jerry Stuckle <jstucklex@attglobal.net> - 2016-02-14 21:43 -0500
        Re: send email and socket programming Jerry Stuckle <jstucklex@attglobal.net> - 2016-02-14 18:05 -0500
    Re: send email and socket programming Christopher Pisz <nospam@notanaddress.com> - 2016-02-16 16:39 -0600
    Re: send email and socket programming alexo <alelvb@inwind.it> - 2016-02-26 04:09 +0100
      Re: send email and socket programming Paavo Helde <myfirstname@osa.pri.ee> - 2016-02-26 07:49 +0200
        Re: send email and socket programming Paavo Helde <myfirstname@osa.pri.ee> - 2016-02-26 08:39 +0200
          Re: send email and socket programming alexo <alelvb@inwind.it> - 2016-02-26 13:15 +0100
            Re: send email and socket programming Paavo Helde <myfirstname@osa.pri.ee> - 2016-02-26 14:40 +0200
              Re: send email and socket programming Christopher Pisz <nospam@notanaddress.com> - 2016-02-26 16:41 -0600
                Re: send email and socket programming alexo <alelvb@inwind.it> - 2016-02-27 13:38 +0100
                  Re: send email and socket programming Öö Tiib <ootiib@hot.ee> - 2016-02-27 05:15 -0800
                    Re: send email and socket programming alexo <alelvb@inwind.it> - 2016-02-27 18:59 +0100
                      Re: send email and socket programming Öö Tiib <ootiib@hot.ee> - 2016-02-27 10:41 -0800
                      Re: send email and socket programming Paavo Helde <myfirstname@osa.pri.ee> - 2016-02-27 21:46 +0200
                Re: send email and socket programming alexo <alelvb@inwind.it> - 2016-02-27 13:42 +0100
                  Re: send email and socket programming alexo <alelvb@inwind.it> - 2016-02-27 19:14 +0100
                    Re: send email and socket programming alexo <alelvb@inwind.it> - 2016-02-27 19:22 +0100
                      Re: send email and socket programming guinness.tony@gmail.com - 2016-02-28 14:19 -0800
        Re: send email and socket programming alexo <alelvb@inwind.it> - 2016-02-27 18:44 +0100
      Re: send email and socket programming Jorgen Grahn <grahn+nntp@snipabacken.se> - 2016-02-27 17:59 +0000
    Re: send email and socket programming alexo <alelvb@inwind.it> - 2016-02-29 14:16 +0100

Page 1 of 3  [1] 2 3  Next page →


#40901 — send email and socket programming

Fromalexo <alelvb@inwind.it>
Date2016-02-14 18:01 +0100
Subjectsend email and socket programming
Message-ID<n9qbsn$of7$1@gioia.aioe.org>
Hello group,

I've written for UNIX a little program [FLTK] that needs to send an 
order through e-mail.

I'm absolutely new to socket programming so you are my first attempt.
In a couple of tutorials I've built a pair of toy client/server programs 
that showed me how to use sockets. It seems not so hard to program them, 
but I need some help and infos.

My program is intended to be a stand alone program with a send button. 
When the user hits the send button I'd like it (the program) sends an 
email to my email address with the order message in it.

I know that SMTP port is 25, but I don't know how to configure the 
aspects required.

Could you please guide me through that, or could you link me to a clear 
intro of the subject?

My program, as already said, is written for Linux, but I'll later 
convert it to Windows where it is intended to run.
Conversion of the GUI part is not necessary since FLTK is a 
cross-platform graphic library, but socket programming is dependent on 
architecture. The functions to invoke are of course different, and I'll 
appreciate it so much if you could explain how to send email from a 
C/C++ program using TCP/IP o SMTP for both linux and windows.

thank you

alexo

[toc] | [next] | [standalone]


#40902

FromJiiPee <no@notvalid.com>
Date2016-02-14 17:07 +0000
Message-ID<uv2wy.996291$TN6.529123@fx34.am4>
In reply to#40901
I did that in my email project back in 2000 in a software company I was 
working. I used a ready made class for doing that. Why not use a 
classes/libraries to do it, why invent the weel again? Or is this more 
like a learning process? That class I used worked very nicely and might 
be even better now.

On 14/02/2016 17:01, alexo wrote:
> Hello group,
>
> I've written for UNIX a little program [FLTK] that needs to send an 
> order through e-mail.
>
> I'm absolutely new to socket programming so you are my first attempt.
> In a couple of tutorials I've built a pair of toy client/server 
> programs that showed me how to use sockets. It seems not so hard to 
> program them, but I need some help and infos.
>
> My program is intended to be a stand alone program with a send button. 
> When the user hits the send button I'd like it (the program) sends an 
> email to my email address with the order message in it.
>
> I know that SMTP port is 25, but I don't know how to configure the 
> aspects required.
>
> Could you please guide me through that, or could you link me to a 
> clear intro of the subject?
>
> My program, as already said, is written for Linux, but I'll later 
> convert it to Windows where it is intended to run.
> Conversion of the GUI part is not necessary since FLTK is a 
> cross-platform graphic library, but socket programming is dependent on 
> architecture. The functions to invoke are of course different, and 
> I'll appreciate it so much if you could explain how to send email from 
> a C/C++ program using TCP/IP o SMTP for both linux and windows.
>
> thank you
>
> alexo

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


#40904

FromJiiPee <no@notvalid.com>
Date2016-02-14 17:12 +0000
Message-ID<Zz2wy.1015182$Vm2.670849@fx44.am4>
In reply to#40902
If I remember correctly, it was actually this one:
http://www.codesink.org/mimetic_mime_library.html#intro

anyway, that looks something I was using

On 14/02/2016 17:07, JiiPee wrote:
> I did that in my email project back in 2000 in a software company I 
> was working. I used a ready made class for doing that. Why not use a 
> classes/libraries to do it, why invent the weel again? Or is this more 
> like a learning process? That class I used worked very nicely and 
> might be even better now.
>
> On 14/02/2016 17:01, alexo wrote:
>> Hello group,
>>
>> I've written for UNIX a little program [FLTK] that needs to send an 
>> order through e-mail.
>>
>> I'm absolutely new to socket programming so you are my first attempt.
>> In a couple of tutorials I've built a pair of toy client/server 
>> programs that showed me how to use sockets. It seems not so hard to 
>> program them, but I need some help and infos.
>>
>> My program is intended to be a stand alone program with a send 
>> button. When the user hits the send button I'd like it (the program) 
>> sends an email to my email address with the order message in it.
>>
>> I know that SMTP port is 25, but I don't know how to configure the 
>> aspects required.
>>
>> Could you please guide me through that, or could you link me to a 
>> clear intro of the subject?
>>
>> My program, as already said, is written for Linux, but I'll later 
>> convert it to Windows where it is intended to run.
>> Conversion of the GUI part is not necessary since FLTK is a 
>> cross-platform graphic library, but socket programming is dependent 
>> on architecture. The functions to invoke are of course different, and 
>> I'll appreciate it so much if you could explain how to send email 
>> from a C/C++ program using TCP/IP o SMTP for both linux and windows.
>>
>> thank you
>>
>> alexo
>

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


#40909

Fromalexo <alelvb@inwind.it>
Date2016-02-14 19:44 +0100
Message-ID<n9qhva$12fn$1@gioia.aioe.org>
In reply to#40902
Il 14/02/2016 18:07, JiiPee ha scritto:
> Why not use a classes/libraries to do it, why invent the weel again? Or is this more
> like a learning process? That class I used worked very nicely and might
> be even better now.

I didn't know there were these opportunities.
I Think I'll study a bit how socket programming works behind the scenes.
Thank you

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


#40906

FromPaavo Helde <myfirstname@osa.pri.ee>
Date2016-02-14 19:18 +0200
Message-ID<YLGdndKzQNJxK13LnZ2dnUU78SWdnZ2d@giganews.com>
In reply to#40901
On 14.02.2016 19:01, alexo wrote:
> Hello group,
>
> I've written for UNIX a little program [FLTK] that needs to send an
> order through e-mail.
>
> I'm absolutely new to socket programming so you are my first attempt.
> In a couple of tutorials I've built a pair of toy client/server programs
> that showed me how to use sockets. It seems not so hard to program them,
> but I need some help and infos.

In C++, when working with sockets I would strongly recommend using a 
cross-platform library or framework for that, otherwise you will never 
get the hairy platform-specific tricks correct.

Boost asio is an example of such a good library, probably there are 
others. ASIO mean async i/O, it might be you don't need its asynchronous 
capabilities in the beginning, so you can ignore them, the rest of the 
library still does much work for you. Just look up the examples and 
build on top of them.

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


#40908

FromÖö Tiib <ootiib@hot.ee>
Date2016-02-14 09:39 -0800
Message-ID<4f4fa7a2-208b-4018-8649-ce13bde6bff7@googlegroups.com>
In reply to#40901
On Sunday, 14 February 2016 19:01:29 UTC+2, alexo  wrote:
> Hello group,
> 
> I've written for UNIX a little program [FLTK] that needs to send an 
> order through e-mail.
> 
> I'm absolutely new to socket programming so you are my first attempt.
> In a couple of tutorials I've built a pair of toy client/server programs 
> that showed me how to use sockets. It seems not so hard to program them, 
> but I need some help and infos.
> 
> My program is intended to be a stand alone program with a send button. 
> When the user hits the send button I'd like it (the program) sends an 
> email to my email address with the order message in it.
> 
> I know that SMTP port is 25, but I don't know how to configure the 
> aspects required.
> 
> Could you please guide me through that, or could you link me to a clear 
> intro of the subject?

Why you use e-mail? There can be SSL/TLS connection made between SMTP,
IMAP or POP3 server and client but lot of servers do not do even that,
instead ask for authentication as open text. There also are no guarantee
any further, so e-mail can travel between servers as open text anyway.
So it is basically only worthless spam that can be sent by e-mail.

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


#40912

Fromalexo <alelvb@inwind.it>
Date2016-02-14 20:23 +0100
Message-ID<n9qk8d$169j$1@gioia.aioe.org>
In reply to#40908
Il 14/02/2016 18:39, Öö Tiib ha scritto:

> Why you use e-mail?

This was the first and simplest idea I got. Otherwise I had to implement 
a server and it is up to now out of my reach.

> There can be SSL/TLS connection made between SMTP,
> IMAP or POP3 server and client but lot of servers do not do even that,
> instead ask for authentication as open text. There also are no guarantee
> any further, so e-mail can travel between servers as open text anyway.

SSL/TLS is another thing should I have to learn? No thank you,
I'm not other than a hobbist.
That's too much for what I'm trying to do.

Thank you anyway.

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


#40910

Fromwoodbrian77@gmail.com
Date2016-02-14 10:47 -0800
Message-ID<7cd16aed-cce0-4d75-89e9-a70eaf3f0f9d@googlegroups.com>
In reply to#40901
On Sunday, February 14, 2016 at 11:01:29 AM UTC-6, alexo wrote:
> Hello group,
> 
> I've written for UNIX a little program [FLTK] that needs to send an 
> order through e-mail.
> 
> I'm absolutely new to socket programming so you are my first attempt.
> In a couple of tutorials I've built a pair of toy client/server programs 
> that showed me how to use sockets. It seems not so hard to program them, 
> but I need some help and infos.
> 
> My program is intended to be a stand alone program with a send button. 
> When the user hits the send button I'd like it (the program) sends an 
> email to my email address with the order message in it.
> 
> I know that SMTP port is 25, but I don't know how to configure the 
> aspects required.
> 
> Could you please guide me through that, or could you link me to a clear 
> intro of the subject?
> 
> My program, as already said, is written for Linux, but I'll later 
> convert it to Windows where it is intended to run.
> Conversion of the GUI part is not necessary since FLTK is a 
> cross-platform graphic library, but socket programming is dependent on 
> architecture. The functions to invoke are of course different, and I'll 
> appreciate it so much if you could explain how to send email from a 
> C/C++ program using TCP/IP o SMTP for both linux and windows.
> 
> thank you
> 
> alexo

I've written some software that supports sending messages
over sockets on Linux, Windows and other operating systems.
There's a library available here:

http://webEbenezer.net/build_integration.html

Feel free to use the library in your project.

I also have an on line code generator called the C++ 
Middleware Writer (CMW) that might be helpful.  I'm 
willing to donate 16 hours/week for six months to a 
project that uses the CMW.

Also we'll pay $1,400 and give a $1,200 investment in the 
company to someone who helps us find someone interested 
in this offer.  We'll pay the $1,400 after working for four 
months on the project.  Ebenezer Enterprises works to reward 
investments to 3 times the original amount.  So the 
investment would result in between $0 and $3,600, depending 
on how things go for the company.

Brian
Ebenezer Enterprises - In G-d we trust.
http://webEbenezer.net

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


#40911

FromPaavo Helde <myfirstname@osa.pri.ee>
Date2016-02-14 21:19 +0200
Message-ID<0tWdnRoeG6HGTl3LnZ2dnUU78WednZ2d@giganews.com>
In reply to#40901
On 14.02.2016 19:01, alexo wrote:
> Hello group,
>
> I've written for UNIX a little program [FLTK] that needs to send an
> order through e-mail.
>
> I'm absolutely new to socket programming so you are my first attempt.
> In a couple of tutorials I've built a pair of toy client/server programs
> that showed me how to use sockets. It seems not so hard to program them,
> but I need some help and infos.
>
> My program is intended to be a stand alone program with a send button.
> When the user hits the send button I'd like it (the program) sends an
> email to my email address with the order message in it.

On a second thought, why do you need sockets at all? If you just want 
the program to send you an order by e-mail, you could just open an URL like

mailto:yourname@example.com?subject=Order&body=Order%20details%20here

In Windows, this should be passed to the ShellExecute SDK function. In 
Linux I guess there is no 100% sure way, but xdg-email ought to work in 
most environments.

This would also give the user an opportunity to review the order and add 
additional comments.

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


#40913

Fromalexo <alelvb@inwind.it>
Date2016-02-14 20:29 +0100
Message-ID<n9qkig$16ln$1@gioia.aioe.org>
In reply to#40911
Il 14/02/2016 20:19, Paavo Helde ha scritto:

> On a second thought, why do you need sockets at all? If you just want
> the program to send you an order by e-mail, you could just open an URL like
>
> mailto:yourname@example.com?subject=Order&body=Order%20details%20here

The software I intend to use formats the info of the order sent in a way 
easy to intellect.
My clients are too lazy to compile a form from their own with all the 
infos formatted in a readable way.

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


#40918

FromPaavo Helde <myfirstname@osa.pri.ee>
Date2016-02-14 22:29 +0200
Message-ID<UYmdnfhb8L0zfl3LnZ2dnUU78WmdnZ2d@giganews.com>
In reply to#40913
On 14.02.2016 21:29, alexo wrote:
> Il 14/02/2016 20:19, Paavo Helde ha scritto:
>
>> On a second thought, why do you need sockets at all? If you just want
>> the program to send you an order by e-mail, you could just open an URL
>> like
>>
>> mailto:yourname@example.com?subject=Order&body=Order%20details%20here
>
> The software I intend to use formats the info of the order sent in a way
> easy to intellect.
> My clients are too lazy to compile a form from their own with all the
> infos formatted in a readable way.

I guess you overlooked the body field in the URL.

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


#40923

Fromalexo <alelvb@inwind.it>
Date2016-02-14 22:45 +0100
Message-ID<n9qshj$1kv4$1@gioia.aioe.org>
In reply to#40918
Il 14/02/2016 21:29, Paavo Helde ha scritto:
> On 14.02.2016 21:29, alexo wrote:
>> Il 14/02/2016 20:19, Paavo Helde ha scritto:
>>
>>> On a second thought, why do you need sockets at all? If you just want
>>> the program to send you an order by e-mail, you could just open an URL
>>> like
>>>
>>> mailto:yourname@example.com?subject=Order&body=Order%20details%20here
>>
>> The software I intend to use formats the info of the order sent in a way
>> easy to intellect.
>> My clients are too lazy to compile a form from their own with all the
>> infos formatted in a readable way.
>
> I guess you overlooked the body field in the URL.
>

Probably I have not well understood your technique.
Say that I push the send data button in m program to build the message
how can I send it via mail using the mailto string you gave me?

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


#40924

FromPaavo Helde <myfirstname@osa.pri.ee>
Date2016-02-15 00:15 +0200
Message-ID<wcOdna2fwNPuYV3LnZ2dnUU78LOdnZ2d@giganews.com>
In reply to#40923
On 14.02.2016 23:45, alexo wrote:
> Il 14/02/2016 21:29, Paavo Helde ha scritto:
>> On 14.02.2016 21:29, alexo wrote:
>>> Il 14/02/2016 20:19, Paavo Helde ha scritto:
>>>
>>>> On a second thought, why do you need sockets at all? If you just want
>>>> the program to send you an order by e-mail, you could just open an URL
>>>> like
>>>>
>>>> mailto:yourname@example.com?subject=Order&body=Order%20details%20here
>>>
>>> The software I intend to use formats the info of the order sent in a way
>>> easy to intellect.
>>> My clients are too lazy to compile a form from their own with all the
>>> infos formatted in a readable way.
>>
>> I guess you overlooked the body field in the URL.
>>
>
> Probably I have not well understood your technique.
> Say that I push the send data button in m program to build the message
> how can I send it via mail using the mailto string you gave me?

You run xdg-email with the URL as an argument, or invoke 
ShellExecute("open", ...) with this URL, depending on the platform. This 
should bring up a new mail window with the default e-mail app configured 
for the system, with the pre-filled address, subject and body. The user 
just needs to click the send button.

When reading other responses about firewalls etc, I'm starting to think 
this might be the most robust approach after all.

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


#40926

FromPaavo Helde <myfirstname@osa.pri.ee>
Date2016-02-15 00:39 +0200
Message-ID<i_qdnflkkvu8n1zLnZ2dnUU78LednZ2d@giganews.com>
In reply to#40924
On 15.02.2016 0:15, Paavo Helde wrote:
> On 14.02.2016 23:45, alexo wrote:
>> Il 14/02/2016 21:29, Paavo Helde ha scritto:
>>> On 14.02.2016 21:29, alexo wrote:
>>>> Il 14/02/2016 20:19, Paavo Helde ha scritto:
>>>>
>>>>> On a second thought, why do you need sockets at all? If you just want
>>>>> the program to send you an order by e-mail, you could just open an URL
>>>>> like
>>>>>
>>>>> mailto:yourname@example.com?subject=Order&body=Order%20details%20here
>>>>
>>>> The software I intend to use formats the info of the order sent in a
>>>> way
>>>> easy to intellect.
>>>> My clients are too lazy to compile a form from their own with all the
>>>> infos formatted in a readable way.
>>>
>>> I guess you overlooked the body field in the URL.
>>>
>>
>> Probably I have not well understood your technique.
>> Say that I push the send data button in m program to build the message
>> how can I send it via mail using the mailto string you gave me?
>
> You run xdg-email with the URL as an argument,

Oh, and on Linux of course there should be the ancient 'mail' program 
which can be automated even better and does not require user interaction 
or X-Windows. I guess from a C or C++ program this can be best launched 
by the popen() system call.



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


#40928

FromChris Vine <chris@cvine--nospam--.freeserve.co.uk>
Date2016-02-14 23:01 +0000
Message-ID<20160214230131.458a02a6@bother.homenet>
In reply to#40926
On Mon, 15 Feb 2016 00:39:30 +0200
Paavo Helde <myfirstname@osa.pri.ee> wrote:
> On 15.02.2016 0:15, Paavo Helde wrote:
> > On 14.02.2016 23:45, alexo wrote:  
> >> Il 14/02/2016 21:29, Paavo Helde ha scritto:  
> >>> On 14.02.2016 21:29, alexo wrote:  
> >>>> Il 14/02/2016 20:19, Paavo Helde ha scritto:
> >>>>  
> >>>>> On a second thought, why do you need sockets at all? If you
> >>>>> just want the program to send you an order by e-mail, you could
> >>>>> just open an URL like
> >>>>>
> >>>>> mailto:yourname@example.com?subject=Order&body=Order%20details%20here  
> >>>>
> >>>> The software I intend to use formats the info of the order sent
> >>>> in a way
> >>>> easy to intellect.
> >>>> My clients are too lazy to compile a form from their own with
> >>>> all the infos formatted in a readable way.  
> >>>
> >>> I guess you overlooked the body field in the URL.
> >>>  
> >>
> >> Probably I have not well understood your technique.
> >> Say that I push the send data button in m program to build the
> >> message how can I send it via mail using the mailto string you
> >> gave me?  
> >
> > You run xdg-email with the URL as an argument,  
> 
> Oh, and on Linux of course there should be the ancient 'mail' program 
> which can be automated even better and does not require user
> interaction or X-Windows. I guess from a C or C++ program this can be
> best launched by the popen() system call.

These days its mailx, according to IEEE Std 1003.1, 2013.  However, it
won't help.  First, ordinary users do not have mail servers running on
localhost, nor do they normally have sendmail or postfix installed.
Secondly, if they do, mail sent via them will probably be blocked, as
most spam blockers these days will reject mail not coming via a
recognised ISP's mail relay.  It so happens that for my own reasons I
do have a mail server running on localhost on my laptop, but it just
forwards on to a recognised mail relay for that reason.

The OP's problem is that he does not understand how email works.  What
he needs to do is obtain particulars of the user's ISP's mail relay,
or if the user is operating from business premises, of the business's
mail relay.  On windows, in cases where a user has Outlook installed
there may well be a system call to obtain the address previously
entered by the user (or by the system administrator) for the purposes of
email she sends via Outlook (I don't know if there is or there isn't,
but it would not surprise me if there is).  But that would only work
for users who do have Outlook installed, and there is no equivalent for
the general run of unix-like OSes.  My mail client for example requires
me to enter the mail relay into a configuration dialog when I first
start up the program.  Microsoft's consumer products do the same.

The other thing is that this has nothing to do with C++.  The OP would
have the same problem if he were coding with Python, Java, C or any
other language.

Chris

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


#40934

FromGeoff <geoff@invalid.invalid>
Date2016-02-14 15:22 -0800
Message-ID<7t22cb9bsm4uc7on4fld52gi94vln1pj12@4ax.com>
In reply to#40928
On Sun, 14 Feb 2016 23:01:31 +0000, Chris Vine
<chris@cvine--nospam--.freeserve.co.uk> wrote:

>hese days its mailx, according to IEEE Std 1003.1, 2013.  However, it
>won't help.  First, ordinary users do not have mail servers running on
>localhost, nor do they normally have sendmail or postfix installed.

I think you misunderstood. The mailto:: URL invokes the users default
mail client, not a server. There is no local server involved and those
services need not exist on the localhost, nor does the mail client
communicate with a localhost socket, it communicates with the user's
own mail server using his own client under his control and under his
own credentials.

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


#40938

FromJerry Stuckle <jstucklex@attglobal.net>
Date2016-02-14 18:41 -0500
Message-ID<n9r36l$2s3$2@jstuckle.eternal-september.org>
In reply to#40934
On 2/14/2016 6:22 PM, Geoff wrote:
> On Sun, 14 Feb 2016 23:01:31 +0000, Chris Vine
> <chris@cvine--nospam--.freeserve.co.uk> wrote:
> 
>> hese days its mailx, according to IEEE Std 1003.1, 2013.  However, it
>> won't help.  First, ordinary users do not have mail servers running on
>> localhost, nor do they normally have sendmail or postfix installed.
> 
> I think you misunderstood. The mailto:: URL invokes the users default
> mail client, not a server. There is no local server involved and those
> services need not exist on the localhost, nor does the mail client
> communicate with a localhost socket, it communicates with the user's
> own mail server using his own client under his control and under his
> own credentials.
> 

mailto: only works in a program which understands it (i.e. a browser).
Unless he builds support for it into his program, it will not work.

He will have to determine what the default mail client is and invoke it
from his program.

-- 
==================
Remove the "x" from my email address
Jerry Stuckle
jstucklex@attglobal.net
==================

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


#40939

FromChris Vine <chris@cvine--nospam--.freeserve.co.uk>
Date2016-02-14 23:43 +0000
Message-ID<20160214234322.414dc3af@bother.homenet>
In reply to#40934
On Sun, 14 Feb 2016 15:22:43 -0800
Geoff <geoff@invalid.invalid> wrote:
> On Sun, 14 Feb 2016 23:01:31 +0000, Chris Vine
> <chris@cvine--nospam--.freeserve.co.uk> wrote:
> 
> >hese days its mailx, according to IEEE Std 1003.1, 2013.  However, it
> >won't help.  First, ordinary users do not have mail servers running
> >on localhost, nor do they normally have sendmail or postfix
> >installed.  
> 
> I think you misunderstood. The mailto:: URL invokes the users default
> mail client, not a server. There is no local server involved and those
> services need not exist on the localhost, nor does the mail client
> communicate with a localhost socket, it communicates with the user's
> own mail server using his own client under his control and under his
> own credentials.

Yes, I agree that if they have that mimetype set up, that would indeed
work for the purpose of bringing up the mail client.

The OP's problem is getting his text form (the order message he
referred to) into the client. Is there a standard means of doing that?
(I am not saying there isn't, but I am not sure I have seen that when I
have sent emails that way myself).

Chris

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


#40941

FromGeoff <geoff@invalid.invalid>
Date2016-02-14 17:33 -0800
Message-ID<vja2cbhrvrej05ca41jg8gvmn7atc2qspo@4ax.com>
In reply to#40939
On Sun, 14 Feb 2016 23:43:22 +0000, Chris Vine
<chris@cvine--nospam--.freeserve.co.uk> wrote:

>On Sun, 14 Feb 2016 15:22:43 -0800
>Geoff <geoff@invalid.invalid> wrote:
>> On Sun, 14 Feb 2016 23:01:31 +0000, Chris Vine
>> <chris@cvine--nospam--.freeserve.co.uk> wrote:
>> 
>> >hese days its mailx, according to IEEE Std 1003.1, 2013.  However, it
>> >won't help.  First, ordinary users do not have mail servers running
>> >on localhost, nor do they normally have sendmail or postfix
>> >installed.  
>> 
>> I think you misunderstood. The mailto:: URL invokes the users default
>> mail client, not a server. There is no local server involved and those
>> services need not exist on the localhost, nor does the mail client
>> communicate with a localhost socket, it communicates with the user's
>> own mail server using his own client under his control and under his
>> own credentials.
>
>Yes, I agree that if they have that mimetype set up, that would indeed
>work for the purpose of bringing up the mail client.
>
>The OP's problem is getting his text form (the order message he
>referred to) into the client. Is there a standard means of doing that?
>(I am not saying there isn't, but I am not sure I have seen that when I
>have sent emails that way myself).
>
>Chris

In Windows, I'd put the URL into a dialog box, such as a Help dialog
or in an Order Something dialog opened from the Help menu item. I'd do
it the same in OSX and the equivalent in Linux dialogs. The OP hasn't
stated his target OS but I suspect it's Linux.

A standard way to do it? I'm not so sure. I know this works in
Windows:
system("start

mailto:yourname@example.com?subject=Order&body=Order%20details%20here");

I think the equivalent is 
system("exec

mailto:yourname@example.com?subject=Order&body=Order%20details%20here");

but I haven't tested this.

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


#40944

FromPaavo Helde <myfirstname@osa.pri.ee>
Date2016-02-15 09:37 +0200
Message-ID<jcCdnYuBq7rOHVzLnZ2dnUU78XmdnZ2d@giganews.com>
In reply to#40941
On 15.02.2016 3:33, Geoff wrote:
> On Sun, 14 Feb 2016 23:43:22 +0000, Chris Vine
> <chris@cvine--nospam--.freeserve.co.uk> wrote:
>
>> On Sun, 14 Feb 2016 15:22:43 -0800
>> Geoff <geoff@invalid.invalid> wrote:
>>> On Sun, 14 Feb 2016 23:01:31 +0000, Chris Vine
>>> <chris@cvine--nospam--.freeserve.co.uk> wrote:
>>>
>>>> hese days its mailx, according to IEEE Std 1003.1, 2013.  However, it
>>>> won't help.  First, ordinary users do not have mail servers running
>>>> on localhost, nor do they normally have sendmail or postfix
>>>> installed.
>>>
>>> I think you misunderstood. The mailto:: URL invokes the users default
>>> mail client, not a server. There is no local server involved and those
>>> services need not exist on the localhost, nor does the mail client
>>> communicate with a localhost socket, it communicates with the user's
>>> own mail server using his own client under his control and under his
>>> own credentials.
>>
>> Yes, I agree that if they have that mimetype set up, that would indeed
>> work for the purpose of bringing up the mail client.
>>
>> The OP's problem is getting his text form (the order message he
>> referred to) into the client. Is there a standard means of doing that?
>> (I am not saying there isn't, but I am not sure I have seen that when I
>> have sent emails that way myself).
>>
>> Chris
>
> In Windows, I'd put the URL into a dialog box, such as a Help dialog
> or in an Order Something dialog opened from the Help menu item. I'd do
> it the same in OSX and the equivalent in Linux dialogs. The OP hasn't
> stated his target OS but I suspect it's Linux.
>
> A standard way to do it? I'm not so sure. I know this works in
> Windows:
> system("start
>
> mailto:yourname@example.com?subject=Order&body=Order%20details%20here");

Yes, ability to open things in a default way (including mail URL-s) is 
built into Windows and can be invoked via the start command in the CMD 
shell. However, from another program one should prefer ShellExecute() 
instead of system(), to avoid a nasty black DOS box on the screen, and 
to avoid nasty quoting problems (for example, the '&' in the above URL 
must be escaped as '^&' when used in the CMD shell).

>
> I think the equivalent is
> system("exec
>
> mailto:yourname@example.com?subject=Order&body=Order%20details%20here");
>
> but I haven't tested this.

I haven't either, but the man page looks like this is the way in 
X-Windows world:

XDG-EMAIL(1)
NAME
        xdg-email - command line tool for sending mail using the user's 
preferred e-mail composer.

And yes, this requires that the user has the ability to send e-mail from 
this computer in the first place and the computer has been set up 
properly. If there is a doubt the user cannot do this, I would display 
the URL and tell the user to copy-paste it into a browser on a machine 
where he can send e-mails.





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


Page 1 of 3  [1] 2 3  Next page →

Back to top | Article view | comp.lang.c++


csiph-web