5

I was trying to do some C++ coding that can send files from my laptop to my webmail account. It took me about 10 minutes to realize that there is no easy way to do this. Look into these links:

  1. GMAIL: http://code.google.com/apis/gmail/oauth/code.html
  2. YAHOO: http://developer.yahoo.com/mail/

I am trying to understand why PHP or Python or Java support exist but no C++. No flame wars, I love all programming languages and their creators equally but I am curious to understand the logic behind such implementation choices.

Walter
16.1k8 gold badges60 silver badges95 bronze badges
asked Dec 26, 2010 at 13:33
1
  • 1
    If you really see a need for it, why don't you write one? Commented Dec 27, 2010 at 0:22

5 Answers 5

4

C++ has its strengths and weaknesses. One weakness is that its library is very thin. Email involves a lot of protocols, HTTP/S, SMTP, POP3, IMAP, etc. I don't see how you can support these protocols easily in a standardized way with C++.

answered Dec 26, 2010 at 14:01
1
  • 2
    Though true (about the thin libraries). This is not the reason why there are no C++ API for these web applications. There are 3rd party libraries for C++ that support all these protocols (you just need curl really). The advantage of C++ is that it is fast, but using it over HTTP nullifies this advantage. So why use a more complex language when a simpler slower one will work. Once you have made this tradeoff they why would you want to support multiple interfaces. Commented Jan 11, 2011 at 18:47
7

Hypothesis: because web APIs are primarily used to integrate their respective services with other web applications. Therefore it is logical to conclude those other services are written in some web-relevant languages. C++ is not one of them.

Anyway APIs here do not seem to be language-specific. They're just offering you a bunch of client libraries out of courtesy, not for all possible languages, but for a narrow selection of the most requested ones. If there isn't one for your needs, nothing prevents you from writing your own client library - maybe even publishing it to make people's lives better. Or maybe there is already one - just google for it.

answered Dec 26, 2010 at 14:02
1
  • 2
    Although C++ is rarely used to directly write web applications, that doesn't mean that it isn't used for interacting with web services. Commented Dec 27, 2010 at 0:21
6

Why no developer API in C++ for Google or Yahoo mail?

Why no developer API in Haskell, Erlang or Brainfuck for Google or Yahoo mail? Because nobody cared enough or needed it so far. Luckily, this is all just HTTP, XML and JSON, so you can build API bindings for any language/platform you want.

answered Dec 26, 2010 at 21:56
2
  • 2
    hackage.haskell.org/package/google-search includes the mail api. gist.github.com/tsloughter/588177 erlang access to google mail (though smtp rather than oath) Commented Jul 8, 2014 at 14:12
  • @PeteKirkham Cool, however that doesn't invalidate my point in any way, i.e. I could easily mention 5 more languages where this is not available. Also the Haskell binding you mention was created in 2013, while my answer was written in 2010. And the Erlang code you mention seems to be plain SMTP, I don't see anything about OAuth in there so it's not about the Google API. Commented Jul 8, 2014 at 16:05
1

There are some C++ or C libraries to send email (using SMTP): VMIME, libsmtp, etc. You could also find IMAP libraries

And you could write C++ web applications, e.g. using an HTTP server library like libonion or wt, or making it a FastCGI client. You can do HTTP client processing using libcurl

However, most people prefer coding web app in e.g. PHP. But you could use Ocaml with ocsigen, or opa or Hop

But your question is probably off-topic here.

0

This is really a summing up of Developer Art's Point:

Nobody (with few exceptions) should write web applications in C++!

answered Dec 26, 2010 at 14:07
4
  • 6
    -1 Completely disagree. Certain web applications would be much better designed in a language like C++. Commented Dec 27, 2010 at 7:20
  • Name one that doesn't have a medium-large company behind it (which would make it infeasible to write their own interface). Commented Dec 27, 2010 at 8:12
  • 1
    -1 See for example the Wt framework: webtoolkit.eu/wt Commented May 1, 2011 at 22:58
  • 2
    @Mauricio, the existence of a framework does not make it a good idea. Commented May 2, 2011 at 5:22

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.