Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.c++ > #40901 > unrolled thread
| Started by | alexo <alelvb@inwind.it> |
|---|---|
| First post | 2016-02-14 18:01 +0100 |
| Last post | 2016-02-29 14:16 +0100 |
| Articles | 20 on this page of 57 — 14 participants |
Back to article view | Back to comp.lang.c++
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 2 of 3 — ← Prev page 1 [2] 3 Next page →
| From | Chris Vine <chris@cvine--nospam--.freeserve.co.uk> |
|---|---|
| Date | 2016-02-15 10:04 +0000 |
| Message-ID | <20160215100444.2c30450b@bother.homenet> |
| In reply to | #40941 |
On Sun, 14 Feb 2016 17:33:02 -0800
Geoff <geoff@invalid.invalid> 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");
>
> I think the equivalent is
> system("exec
>
> mailto:yourname@example.com?subject=Order&body=Order%20details%20here");
>
> but I haven't tested this.
OK that does seem to be the way to do it. Excellent. 'xdg-email
--help' gives me this:
xdg-email -- command line tool for sending mail using the
user's preferred e-mail composer
Synopsis
xdg-email [--utf8] [--cc address] [--bcc address] [--subject
text] [--body text] [--attach file] [ mailto-uri | address(es)]
So this on a unix-like system would do what he wants:
xdg-email --subject Order --body "My order is attached" \
--attach "order-file.txt" order@supplier.net
From a cursory look at it I could not get my email client to accept
line breaks in the message body, so attaching a file might work better
for the OP.
Chris
[toc] | [prev] | [next] | [standalone]
| From | Chris Vine <chris@cvine--nospam--.freeserve.co.uk> |
|---|---|
| Date | 2016-02-15 10:14 +0000 |
| Message-ID | <20160215101426.60199519@bother.homenet> |
| In reply to | #40945 |
On Mon, 15 Feb 2016 10:04:44 +0000 Chris Vine <chris@cvine--nospam--.freeserve.co.uk> wrote: [snip] > From a cursory look at it I could not get my email client to accept > line breaks in the message body, so attaching a file might work better > for the OP. Ah, it does accept line breaks, it's the shell that's problematic. If he executes it via 'exec' and cognates rather than 'system' he will probably be OK.
[toc] | [prev] | [next] | [standalone]
| From | Geoff <geoff@invalid.invalid> |
|---|---|
| Date | 2016-02-15 10:11 -0800 |
| Message-ID | <oa34cbph21395ibimschfrs54tbitlrslq@4ax.com> |
| In reply to | #40946 |
On Mon, 15 Feb 2016 10:14:26 +0000, Chris Vine <chris@cvine--nospam--.freeserve.co.uk> wrote: >On Mon, 15 Feb 2016 10:04:44 +0000 >Chris Vine <chris@cvine--nospam--.freeserve.co.uk> wrote: >[snip] >> From a cursory look at it I could not get my email client to accept >> line breaks in the message body, so attaching a file might work better >> for the OP. > >Ah, it does accept line breaks, it's the shell that's problematic. If >he executes it via 'exec' and cognates rather than 'system' he will >probably be OK. Thanks for testing that. Ultimately, I'd probably still prefer just planting a URL mailto: or just a link to a web server for feedback. An http: link has much greater utility since the form and cgi is under the vendor's control and doesn't require any support from inside the application, it's completely portable and can be redirected if necessary to whatever server the vendor desires. If, as the OP has hinted at, it's some kind of order where money or a credit card could be involved, it can be securely transacted as a web form over SSL rather than an email, especially where the user's identifiable information is going to be transmitted. This gives the vendor complete flexibility on the web server to control the form fields or change its purpose. Web servers are cheap and easily obtained these days, any serious application would have a web presence an users are inclined to expect it. Email addresses are transitory and coding one into an application is probably unwise.
[toc] | [prev] | [next] | [standalone]
| From | Geoff <geoff@invalid.invalid> |
|---|---|
| Date | 2016-02-14 15:16 -0800 |
| Message-ID | <k522cb1v526s21epngl35qck9pa9263flp@4ax.com> |
| In reply to | #40923 |
On Sun, 14 Feb 2016 22:45:24 +0100, alexo <alelvb@inwind.it> 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? Paavo's suggestion is the best. You create your order text and create the URL from it. The mailto: action causes the user's system to invoke his mail program with the content you create. He can then edit it if he likes (you'll need to allow for that at your end) and then he transmits it from his own email account and you never touch TCP within your application. This has many advantages: 1. You don't have to reinvent the wheel. 2. You never touch a socket or need to learn SMTP. 3. You need not worry about port 25, port 465, SMTP, TCP or SSL. 4. It sends the message via the user's own defined email client and his authenticated server. 5. You don't have to violate local firewall policies that might prevent your program from making a connection. This reduces your support workload when dealing with customers and problems with your application. ... there are more but I'll stop here.
[toc] | [prev] | [next] | [standalone]
| From | Ian Collins <ian-news@hotmail.com> |
|---|---|
| Date | 2016-02-15 08:40 +1300 |
| Message-ID | <dic3gqFqc0vU5@mid.individual.net> |
| In reply to | #40901 |
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? Your issue isn't socket programming, it is how to use SMTP! You need a configured SMTP server to interact with and you need to know how to do this. > 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. Using winsock on Windows is almost identical to using sockets on a POSIX system. -- Ian Collins
[toc] | [prev] | [next] | [standalone]
| From | "Chris M. Thomasson" <nospam@nospam.nospam> |
|---|---|
| Date | 2016-02-14 12:09 -0800 |
| Message-ID | <n9qmu8$1ajn$1@gioia.aioe.org> |
| In reply to | #40914 |
> "Ian Collins" wrote in message news:dic3gqFqc0vU5@mid.individual.net... [...] > Using winsock on Windows is almost identical to using sockets on a POSIX > system. FWIW, on Windows wrt winsock I use IOCP via "batched" dequeuing: https://msdn.microsoft.com/en-us/library/windows/desktop/aa364988(v=vs.85).aspx Is there a direct Linux alternative? I guess Kernel async io: http://lse.sourceforge.net/io/aio.html or (epoll): http://davmac.org/davpage/linux/async-io.html#epoll ?
[toc] | [prev] | [next] | [standalone]
| From | Jerry Stuckle <jstucklex@attglobal.net> |
|---|---|
| Date | 2016-02-14 16:04 -0500 |
| Message-ID | <n9qq0a$u0s$1@jstuckle.eternal-september.org> |
| In reply to | #40901 |
On 2/14/2016 12:01 PM, 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 Just beware that nowadays many ISP's are blocking outbound connections to port 25 to prevent spam (often due to viruses and/or trojan horses. This is especially true for residential connections. -- ================== Remove the "x" from my email address Jerry Stuckle jstucklex@attglobal.net ==================
[toc] | [prev] | [next] | [standalone]
| From | jt@toerring.de (Jens Thoms Toerring) |
|---|---|
| Date | 2016-02-14 21:20 +0000 |
| Message-ID | <dic9d3FjoceU1@mid.uni-berlin.de> |
| In reply to | #40901 |
alexo <alelvb@inwind.it> wrote:
> 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?
This rather likely won't work, even if you get everything right.
There are the following issues:
a) You need to figure out the mail server for the address
you want to send the email to. Many machines don't accept
connections on port 25 (or there's a firewall that prevents
accessing the port from the outside). You need to know the
mail server for the recipients domain. To get that you must
do an DNS query for the MX server of the destination domain.
b) Once you got the socket opened to that mail server you
need to understand the SMTP protocol to talk correctly
to the server and transfer the message.
c) While a and b can be done (though it requires quite a bit
of reading the corresponding RFCs) the killer is that most
mail servers nowadays don't accept mail from random machines
but only from the dedicated mail servers from the domain the
email is coming from. So unless the machine sending the mail
is marked in DNS as a mail server for the domain (i.e., has
an MX record) the mail won't get accepted.
d) And, if you want to talk to your own mail server to get it
to pass on the email on, many don't accept emails anymore
without encryption, so you also beed to know how to deal with
SSL/TLS.
On a UNIX system you'd better install and properly configure a
MTA (mail transport agent) that passes on the email to the
mail server for the senders domain that then forwards it to
the correct mail server on the receiving end. This typically
is done by spawning the 'sendmail' program (but which often
is a symbolic link to the actual MTA installed on the machine)
and let it deal with the details of handling the mail.
The nice old times when you could send out an email to your boss,
looking to the uninitiated as coming from 'god@heaven', are, thanks
to spam, over since a number of years.
If there's no usable MTA on the machine you intend to send mails
from you're screwed. And, sorry, no idea how to do it under
Windows...
Regards, Jens
--
\ Jens Thoms Toerring ___ jt@toerring.de
\__________________________ http://toerring.de
[toc] | [prev] | [next] | [standalone]
| From | alexo <alelvb@inwind.it> |
|---|---|
| Date | 2016-02-14 22:40 +0100 |
| Message-ID | <n9qs8l$1kcv$1@gioia.aioe.org> |
| In reply to | #40921 |
Il 14/02/2016 22:20, Jens Thoms Toerring ha scritto: > This rather likely won't work, even if you get everything right. > There are the following issues: > > a) You need to figure out the mail server for the address > you want to send the email to. Many machines don't accept > connections on port 25 (or there's a firewall that prevents > accessing the port from the outside). You need to know the > mail server for the recipients domain. To get that you must > do an DNS query for the MX server of the destination domain. > b) Once you got the socket opened to that mail server you > need to understand the SMTP protocol to talk correctly > to the server and transfer the message. > c) While a and b can be done (though it requires quite a bit > of reading the corresponding RFCs) the killer is that most > mail servers nowadays don't accept mail from random machines > but only from the dedicated mail servers from the domain the > email is coming from. So unless the machine sending the mail > is marked in DNS as a mail server for the domain (i.e., has > an MX record) the mail won't get accepted. > d) And, if you want to talk to your own mail server to get it > to pass on the email on, many don't accept emails anymore > without encryption, so you also beed to know how to deal with > SSL/TLS. > > On a UNIX system you'd better install and properly configure a > MTA (mail transport agent) that passes on the email to the > mail server for the senders domain that then forwards it to > the correct mail server on the receiving end. This typically > is done by spawning the 'sendmail' program (but which often > is a symbolic link to the actual MTA installed on the machine) > and let it deal with the details of handling the mail. > > The nice old times when you could send out an email to your boss, > looking to the uninitiated as coming from 'god@heaven', are, thanks > to spam, over since a number of years. > > If there's no usable MTA on the machine you intend to send mails > from you're screwed. And, sorry, no idea how to do it under > Windows... > Regards, Jens > Oh! Really send a message to port 25 is so difficult? So it seems my only chance is to build the server that listens to my client program. But who assure me that the firewall doesn't stop that incoming transmission?
[toc] | [prev] | [next] | [standalone]
| From | Chris Vine <chris@cvine--nospam--.freeserve.co.uk> |
|---|---|
| Date | 2016-02-14 22:20 +0000 |
| Message-ID | <20160214222003.53e88ad6@bother.homenet> |
| In reply to | #40922 |
On Sun, 14 Feb 2016 22:40:37 +0100 alexo <alelvb@inwind.it> wrote: [snip] > Oh! > Really send a message to port 25 is so difficult? > So it seems my only chance is to build the server that listens to my > client program. But who assure me that the firewall doesn't stop that > incoming transmission? You are missing the point. Sending a message to port 25 is not difficult. There are also many implementations of SMTP servers out there and it would be ridiculous to code your own: if you need one I recommend postfix. However, your putative user probably does not have a mail server running on port 25 on localhost available to them for outgoing mail. Most consumer users set up their mail client to forward mail directly to their ISP's SMTP mail relay, and in such cases you would have to provide some means of allowing your users to do the same (that is, enter particulars of their mail relay), and then your program can call it up on port 25 in the ordinary way. If your user does have a mail server running on port 25 on localhost, with any unix-like system you can get your program to fire up the user's mailx program (this is the POSIX mail utility). Chris
[toc] | [prev] | [next] | [standalone]
| From | Jerry Stuckle <jstucklex@attglobal.net> |
|---|---|
| Date | 2016-02-14 18:01 -0500 |
| Message-ID | <n9r0rk$ohh$1@jstuckle.eternal-september.org> |
| In reply to | #40925 |
On 2/14/2016 5:20 PM, Chris Vine wrote: > On Sun, 14 Feb 2016 22:40:37 +0100 > alexo <alelvb@inwind.it> wrote: > [snip] >> Oh! >> Really send a message to port 25 is so difficult? >> So it seems my only chance is to build the server that listens to my >> client program. But who assure me that the firewall doesn't stop that >> incoming transmission? > > You are missing the point. Sending a message to port 25 is not > difficult. There are also many implementations of SMTP servers out > there and it would be ridiculous to code your own: if you need one I > recommend postfix. > > However, your putative user probably does not have a mail server > running on port 25 on localhost available to them for outgoing mail. > Most consumer users set up their mail client to forward mail directly > to their ISP's SMTP mail relay, and in such cases you would have to > provide some means of allowing your users to do the same (that is, enter > particulars of their mail relay), and then your program can call it up > on port 25 in the ordinary way. > > If your user does have a mail server running on port 25 on localhost, > with any unix-like system you can get your program to fire up the user's > mailx program (this is the POSIX mail utility). > > Chris > You are missing another point. Even if I do have an smtp server running on my machine, I can't send email from it. Outbound connections to port 25 are blocked by my ISP. That is true for many ISPs - at least in the U.S. And even if I could use port 25, many MTAs are configured to reject email from hosts using dynamic IP addresses. I use port 587 to connect to *my* MTA, which is in a data center and has a static IP address. It also requires authentication and an encrypted connection. -- ================== Remove the "x" from my email address Jerry Stuckle jstucklex@attglobal.net ==================
[toc] | [prev] | [next] | [standalone]
| From | Ian Collins <ian-news@hotmail.com> |
|---|---|
| Date | 2016-02-15 12:09 +1300 |
| Message-ID | <dicfovFkj4lU1@mid.individual.net> |
| In reply to | #40929 |
Jerry Stuckle wrote: > On 2/14/2016 5:20 PM, Chris Vine wrote: >> >> However, your putative user probably does not have a mail server >> running on port 25 on localhost available to them for outgoing mail. >> Most consumer users set up their mail client to forward mail directly >> to their ISP's SMTP mail relay, and in such cases you would have to >> provide some means of allowing your users to do the same (that is, enter >> particulars of their mail relay), and then your program can call it up >> on port 25 in the ordinary way. >> >> If your user does have a mail server running on port 25 on localhost, >> with any unix-like system you can get your program to fire up the user's >> mailx program (this is the POSIX mail utility). > > You are missing another point. Even if I do have an smtp server running > on my machine, I can't send email from it. Outbound connections to port > 25 are blocked by my ISP. That is true for many ISPs - at least in the U.S. As Chris said, "Most consumer users set up their mail client to forward mail directly to their ISP's SMTP mail relay". > And even if I could use port 25, many MTAs are configured to reject > email from hosts using dynamic IP addresses. Except those to their mail relay, otherwise customers wouldn't be able to send mail from a regular mail client. -- Ian Collins
[toc] | [prev] | [next] | [standalone]
| From | Jerry Stuckle <jstucklex@attglobal.net> |
|---|---|
| Date | 2016-02-14 18:37 -0500 |
| Message-ID | <n9r2up$2s3$1@jstuckle.eternal-september.org> |
| In reply to | #40931 |
On 2/14/2016 6:09 PM, Ian Collins wrote: > Jerry Stuckle wrote: >> On 2/14/2016 5:20 PM, Chris Vine wrote: >>> >>> However, your putative user probably does not have a mail server >>> running on port 25 on localhost available to them for outgoing mail. >>> Most consumer users set up their mail client to forward mail directly >>> to their ISP's SMTP mail relay, and in such cases you would have to >>> provide some means of allowing your users to do the same (that is, enter >>> particulars of their mail relay), and then your program can call it up >>> on port 25 in the ordinary way. >>> >>> If your user does have a mail server running on port 25 on localhost, >>> with any unix-like system you can get your program to fire up the user's >>> mailx program (this is the POSIX mail utility). >> >> You are missing another point. Even if I do have an smtp server running >> on my machine, I can't send email from it. Outbound connections to port >> 25 are blocked by my ISP. That is true for many ISPs - at least in >> the U.S. > > As Chris said, "Most consumer users set up their mail client to forward > mail directly to their ISP's SMTP mail relay". > I know what Chris said. I was addressing his point of using a mail program on localhost. It will not work on many ISP's. >> And even if I could use port 25, many MTAs are configured to reject >> email from hosts using dynamic IP addresses. > > Except those to their mail relay, otherwise customers wouldn't be able > to send mail from a regular mail client. > Incorrect. Many MTAs are configured to accept mail from other MTAs with static IPs, but reject mail from dynamic IPs. It has nothing to do with being able to send mail from a regular mail client. -- ================== Remove the "x" from my email address Jerry Stuckle jstucklex@attglobal.net ==================
[toc] | [prev] | [next] | [standalone]
| From | Ian Collins <ian-news@hotmail.com> |
|---|---|
| Date | 2016-02-15 13:06 +1300 |
| Message-ID | <dicj4uFkj4lU2@mid.individual.net> |
| In reply to | #40937 |
Jerry Stuckle wrote: > On 2/14/2016 6:09 PM, Ian Collins wrote: >> Jerry Stuckle wrote: > >>> And even if I could use port 25, many MTAs are configured to reject >>> email from hosts using dynamic IP addresses. >> >> Except those to their mail relay, otherwise customers wouldn't be able >> to send mail from a regular mail client. >> > > Incorrect. Many MTAs are configured to accept mail from other MTAs with > static IPs, but reject mail from dynamic IPs. It has nothing to do with > being able to send mail from a regular mail client. I don't know about your part of the world, but here most customers are on a dynamic IP. ISPs will accept incoming SMTP traffic from their dynamic IP range. If they didn't, customers wouldn't be able to send mail, would they? -- Ian Collins
[toc] | [prev] | [next] | [standalone]
| From | Jerry Stuckle <jstucklex@attglobal.net> |
|---|---|
| Date | 2016-02-14 21:40 -0500 |
| Message-ID | <n9rdl0$s67$1@jstuckle.eternal-september.org> |
| In reply to | #40940 |
On 2/14/2016 7:06 PM, Ian Collins wrote: > Jerry Stuckle wrote: >> On 2/14/2016 6:09 PM, Ian Collins wrote: >>> Jerry Stuckle wrote: >> >>>> And even if I could use port 25, many MTAs are configured to reject >>>> email from hosts using dynamic IP addresses. >>> >>> Except those to their mail relay, otherwise customers wouldn't be able >>> to send mail from a regular mail client. >>> >> >> Incorrect. Many MTAs are configured to accept mail from other MTAs with >> static IPs, but reject mail from dynamic IPs. It has nothing to do with >> being able to send mail from a regular mail client. > > I don't know about your part of the world, but here most customers are > on a dynamic IP. ISPs will accept incoming SMTP traffic from their > dynamic IP range. If they didn't, customers wouldn't be able to send > mail, would they? > That's right. Same here. However, ISPs will accept traffic from *AUTHORIZED* users. They do not accept traffic from non-authorized users which are not for their domain(s). And MTAs from other domains are NOT authorized users. You obviously have no idea how to properly configure an MTA. I hope you never do - your concept is known as a spam relay. But coming from you, that doesn't surprise me in the least. -- ================== Remove the "x" from my email address Jerry Stuckle jstucklex@attglobal.net ==================
[toc] | [prev] | [next] | [standalone]
| From | Chris Vine <chris@cvine--nospam--.freeserve.co.uk> |
|---|---|
| Date | 2016-02-14 23:35 +0000 |
| Message-ID | <20160214233500.731dfbeb@bother.homenet> |
| In reply to | #40929 |
On Sun, 14 Feb 2016 18:01:54 -0500 Jerry Stuckle <jstucklex@attglobal.net> wrote: > On 2/14/2016 5:20 PM, Chris Vine wrote: > > On Sun, 14 Feb 2016 22:40:37 +0100 > > alexo <alelvb@inwind.it> wrote: > > [snip] > >> Oh! > >> Really send a message to port 25 is so difficult? > >> So it seems my only chance is to build the server that listens to > >> my client program. But who assure me that the firewall doesn't > >> stop that incoming transmission? > > > > You are missing the point. Sending a message to port 25 is not > > difficult. There are also many implementations of SMTP servers out > > there and it would be ridiculous to code your own: if you need one I > > recommend postfix. > > > > However, your putative user probably does not have a mail server > > running on port 25 on localhost available to them for outgoing mail. > > Most consumer users set up their mail client to forward mail > > directly to their ISP's SMTP mail relay, and in such cases you > > would have to provide some means of allowing your users to do the > > same (that is, enter particulars of their mail relay), and then > > your program can call it up on port 25 in the ordinary way. > > > > If your user does have a mail server running on port 25 on > > localhost, with any unix-like system you can get your program to > > fire up the user's mailx program (this is the POSIX mail utility). > > > > Chris > > > > You are missing another point. Even if I do have an smtp server > running on my machine, I can't send email from it. Outbound > connections to port 25 are blocked by my ISP. That is true for many > ISPs - at least in the U.S. Having just discussed it with myself, I can detect no signs of having missed that. But the point is not that ISPs stop port 25 traffic leaking out of their system (I have not come across that), but that the spam blocker of the next ISP in the link will do so. > I use port 587 to connect to *my* MTA, which is in a data center and > has a static IP address. It also requires authentication and an > encrypted connection. That is great, but irrelevant to the OP's issue. I do encrypted tunnelling from my house in the country (when I am there) to my house in town, to dispatch my mail remotely. I think you need to resist the temptation to show you are clever. Chris
[toc] | [prev] | [next] | [standalone]
| From | Jerry Stuckle <jstucklex@attglobal.net> |
|---|---|
| Date | 2016-02-14 21:43 -0500 |
| Message-ID | <n9rdqn$she$1@jstuckle.eternal-september.org> |
| In reply to | #40936 |
On 2/14/2016 6:35 PM, Chris Vine wrote: > On Sun, 14 Feb 2016 18:01:54 -0500 > Jerry Stuckle <jstucklex@attglobal.net> wrote: >> On 2/14/2016 5:20 PM, Chris Vine wrote: >>> On Sun, 14 Feb 2016 22:40:37 +0100 >>> alexo <alelvb@inwind.it> wrote: >>> [snip] >>>> Oh! >>>> Really send a message to port 25 is so difficult? >>>> So it seems my only chance is to build the server that listens to >>>> my client program. But who assure me that the firewall doesn't >>>> stop that incoming transmission? >>> >>> You are missing the point. Sending a message to port 25 is not >>> difficult. There are also many implementations of SMTP servers out >>> there and it would be ridiculous to code your own: if you need one I >>> recommend postfix. >>> >>> However, your putative user probably does not have a mail server >>> running on port 25 on localhost available to them for outgoing mail. >>> Most consumer users set up their mail client to forward mail >>> directly to their ISP's SMTP mail relay, and in such cases you >>> would have to provide some means of allowing your users to do the >>> same (that is, enter particulars of their mail relay), and then >>> your program can call it up on port 25 in the ordinary way. >>> >>> If your user does have a mail server running on port 25 on >>> localhost, with any unix-like system you can get your program to >>> fire up the user's mailx program (this is the POSIX mail utility). >>> >>> Chris >>> >> >> You are missing another point. Even if I do have an smtp server >> running on my machine, I can't send email from it. Outbound >> connections to port 25 are blocked by my ISP. That is true for many >> ISPs - at least in the U.S. > > Having just discussed it with myself, I can detect no signs of having > missed that. But the point is not that ISPs stop port 25 traffic > leaking out of their system (I have not come across that), but that the > spam blocker of the next ISP in the link will do so. > It is not unusual in the U.S. - and from what I understand, many other parts of the world. >> I use port 587 to connect to *my* MTA, which is in a data center and >> has a static IP address. It also requires authentication and an >> encrypted connection. > > That is great, but irrelevant to the OP's issue. I do encrypted > tunnelling from my house in the country (when I am there) to my house > in town, to dispatch my mail remotely. > > I think you need to resist the temptation to show you are clever. > > Chris > It is *totally* relevant. If he tries to use his code on my (or any of hundreds of other ISP's in the U.S.), his code will fail miserably. It may not cause a problem for *you* - but *you* are not every user (or even a majority of users, if you're in the U.S.) trying to use his code. -- ================== Remove the "x" from my email address Jerry Stuckle jstucklex@attglobal.net ==================
[toc] | [prev] | [next] | [standalone]
| From | Jerry Stuckle <jstucklex@attglobal.net> |
|---|---|
| Date | 2016-02-14 18:05 -0500 |
| Message-ID | <n9r11p$sm8$1@jstuckle.eternal-september.org> |
| In reply to | #40922 |
On 2/14/2016 4:40 PM, alexo wrote: > Il 14/02/2016 22:20, Jens Thoms Toerring ha scritto: > >> This rather likely won't work, even if you get everything right. >> There are the following issues: >> >> a) You need to figure out the mail server for the address >> you want to send the email to. Many machines don't accept >> connections on port 25 (or there's a firewall that prevents >> accessing the port from the outside). You need to know the >> mail server for the recipients domain. To get that you must >> do an DNS query for the MX server of the destination domain. >> b) Once you got the socket opened to that mail server you >> need to understand the SMTP protocol to talk correctly >> to the server and transfer the message. >> c) While a and b can be done (though it requires quite a bit >> of reading the corresponding RFCs) the killer is that most >> mail servers nowadays don't accept mail from random machines >> but only from the dedicated mail servers from the domain the >> email is coming from. So unless the machine sending the mail >> is marked in DNS as a mail server for the domain (i.e., has >> an MX record) the mail won't get accepted. >> d) And, if you want to talk to your own mail server to get it >> to pass on the email on, many don't accept emails anymore >> without encryption, so you also beed to know how to deal with >> SSL/TLS. >> >> On a UNIX system you'd better install and properly configure a >> MTA (mail transport agent) that passes on the email to the >> mail server for the senders domain that then forwards it to >> the correct mail server on the receiving end. This typically >> is done by spawning the 'sendmail' program (but which often >> is a symbolic link to the actual MTA installed on the machine) >> and let it deal with the details of handling the mail. >> >> The nice old times when you could send out an email to your boss, >> looking to the uninitiated as coming from 'god@heaven', are, thanks >> to spam, over since a number of years. >> >> If there's no usable MTA on the machine you intend to send mails >> from you're screwed. And, sorry, no idea how to do it under >> Windows... >> Regards, Jens >> > > Oh! > Really send a message to port 25 is so difficult? > So it seems my only chance is to build the server that listens to my > client program. But who assure me that the firewall doesn't stop that > incoming transmission? > > No one does. The ISP can block it any time they wish. In addition, you do NOT want to allow people to relay to other domains through your server. It won't take long for spammers to find and start using it, also. If you set up such a server, you must ensure you have proper authentication in place. -- ================== Remove the "x" from my email address Jerry Stuckle jstucklex@attglobal.net ==================
[toc] | [prev] | [next] | [standalone]
| From | Christopher Pisz <nospam@notanaddress.com> |
|---|---|
| Date | 2016-02-16 16:39 -0600 |
| Message-ID | <na088m$fig$1@dont-email.me> |
| In reply to | #40901 |
On 2/14/2016 11:01 AM, 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 If you want to do it the old school way then you learn how to program sockets and then you learn the protocol you want to use. In this case SMTP. In linux, you would use Berkely Sockets. In Windows, you would use Winsock. Both have a plethora of tutorials and books that all go through the same thing. The guide I used some decades ago: http://beej.us/guide/bgnet/output/html/multipage/index.html If you want something more modern, after you learn how they actually work, then you would use boost::asio or some 3rd party library. boost::asio is much easier to understand after you know what you are doing with Berkley sockets. After you can program sockets sufficiently, you would just google up the RFC for whatever protocol you want to use. In this case SMTP: http://www.rfc-base.org/txt/rfc-2821.txt But, again, with something as popular as SMTP, someone else has probably already created a library that will save you the hassle of learning every significant detail. -- I have chosen to troll filter/ignore all subthreads containing the words: "Rick C. Hodgins", "Flibble", and "Islam" So, I won't be able to see or respond to any such messages ---
[toc] | [prev] | [next] | [standalone]
| From | alexo <alelvb@inwind.it> |
|---|---|
| Date | 2016-02-26 04:09 +0100 |
| Message-ID | <naofkc$1o38$1@gioia.aioe.org> |
| In reply to | #40901 |
> I've written for UNIX a little program [FLTK] that needs to send an > order through e-mail. > As JiiPee suggested, I've found a very powerful library named curl. The one he suggested, mimetic, has a bug. I'm an absolute beginner on the field but adapting the example code, I was able to send with curl my first email from a C/C++ program. When I insert the code in my program the data transmission seems not going to an end. I use it inside a wrapper function that is called-back pressing a FLTK button. The specific failing function is curl_easy_perform() that correctly works on the toy test program. any help? thank you
[toc] | [prev] | [next] | [standalone]
Page 2 of 3 — ← Prev page 1 [2] 3 Next page →
Back to top | Article view | comp.lang.c++
csiph-web