Emails in C++

Started by
58 comments, last by jbadams 16 years, 2 months ago
sendemail

Then use
#include <stringstream>#include <string>...std::ostringstream buf;buf << "sendmail.exe ";        // path to sendmail.exebuf << "-f " << address_from;  // sender's addressbuf << "-m " << message_body;  // bodybuf << "-s " << smtp_host;     // server to use for sendingbuf << // any other parameters you want to sendsystem(buf.str().c_str());


It's somewhat ugly, but should get the job done with minimum fuss.
Advertisement
doesnt libcurl support smtp?
Quote:Original post by Antheus
sendemail

Then use *** Source Snippet Removed ***

It's somewhat ugly, but should get the job done with minimum fuss.


Thanks, But I thought there was an option to send emails with smtp in C++. I guess C++ is limited.

Quote:Original post by bigjoe11a
Quote:Original post by Antheus
sendemail

Then use *** Source Snippet Removed ***

It's somewhat ugly, but should get the job done with minimum fuss.


Thanks, But I thought there was an option to send emails with smtp in C++. I guess C++ is limited.


Because it depends on external libraries for almost everything. If you are unwilling to learn how to use libraries then you will never be able to do something non trivial in C++. There are languages out there that have large standard libraries, like Ruby.

Libraries aren't especially difficult. It won't take you long to get the hang of using them if you apply yourself.
Quote:Original post by bigjoe11a
Quote:Original post by Antheus
sendemail

Then use *** Source Snippet Removed ***

It's somewhat ugly, but should get the job done with minimum fuss.


Thanks, But I thought there was an option to send emails with smtp in C++. I guess C++ is limited.


Actually C++ is one of the most unlimited languages. Ok so it may not have email sending functions built in, but if you took that attitude then noone would use it for anything since functionality comes from libraries (which are often written in C++). If you wanted to do this manually i suggest looking up the RFC for SMTP (as mentioned already) which will show you the packet structure that you need to send to mail servers.
Quote:Original post by Dave
Quote:Original post by bigjoe11a
Quote:Original post by Antheus
sendemail

Then use *** Source Snippet Removed ***

It's somewhat ugly, but should get the job done with minimum fuss.


Thanks, But I thought there was an option to send emails with smtp in C++. I guess C++ is limited.


Actually C++ is one of the most unlimited languages. Ok so it may not have email sending functions built in, but if you took that attitude then noone would use it for anything since functionality comes from libraries (which are often written in C++). If you wanted to do this manually i suggest looking up the RFC for SMTP (as mentioned already) which will show you the packet structure that you need to send to mail servers.


Dave I think you need to change your attitude. Remember that finding help at all is not all ways available for most Libraries. If you want to help. Then your well come to give me a clue. Or Please don't post. Your wasting my time and every one else's time.

My point is that if you want to take the time to help me setup and install the libraries. Thats fine. Or just don't post at all



Actually, you're the one wasting peoples time by refusing to apply yourself and asking for help for every little thing. If you aren't willing to do some work on your own then why should people want to help you?
Quote:Original post by Antheus
sendemail

Then use *** Source Snippet Removed ***

It's somewhat ugly, but should get the job done with minimum fuss.


Note: <sstream>, not <stringstream>. Sad but true.
Quote:Remember that finding help at all is not all ways available for most Libraries.

What have you tried? What libraries did you download? Where did you get stuck? What did not work? I have used a number of C++ libraries in my day and have yet to find one that did not come with some form of documentation. It may not have a full on hold-your-hand-start-to-finish tutorial, but it will at least have a README file that explains any set up instructions, and then comments in the source code to help you figure out how to use it.
C++ is a pretty low level language. You can do anything you want to with it, including create email sending functionality. The problem is, you have to write the code yourself. There is no built-in SendEmail() function. You can build such a function by writing the underlying network code and then using SMTP. But unless you are just trying to learn how email systems work, you should use a language that has email capability. Maybe if you explain what you are trying to do, someone can suggest a language more suitable for your project.

Looking at your other post, if you want SQL and email capability, why don't you use PHP? Why do you insist on using C++? If you want help, why don't you start helping us by explaining the problem *completely*. That means outline the steps that *you* have already tried, and where you are getting stuck. Let us understand what you are doing and why it has to be done in C++. It seems like you keep posting the same kinds of questions and getting the same answers. I only tell you this because it is the kind of pattern that will eventually get you completely ignored. If that is not your goal, then help us help you.

[Edited by - CodeMunkie on February 12, 2008 2:18:56 PM]
"When you die, if you get a choice between going to regular heaven or pie heaven, choose pie heaven. It might be a trick, but if it's not, mmmmmmm, boy."
How to Ask Questions the Smart Way.
Quote:Original post by CodeMunkie
Quote:Remember that finding help at all is not all ways available for most Libraries.

What have you tried? What libraries did you download? Where did you get stuck? What did not work? I have used a number of C++ libraries in my day and have yet to find one that did not come with some form of documentation. It may not have a full on hold-your-hand-start-to-finish tutorial, but it will at least have a README file that explains any set up instructions, and then comments in the source code to help you figure out how to use it.
C++ is a pretty low level language. You can do anything you want to with it, including create email sending functionality. The problem is, you have to write the code yourself. There is no built-in SendEmail() function. You can build such a function by writing the underlying network code and then using SMTP. But unless you are just trying to learn how email systems work, you should use a language that has email capability. Maybe if you explain what you are trying to do, someone can suggest a language more suitable for your project.

Looking at your other post, if you want SQL and email capability, why don't you use PHP? Why do you insist on using C++? If you want help, why don't you start helping us by explaining the problem *completely*. That means outline the steps that *you* have already tried, and where you are getting stuck. Let us understand what you are doing and why it has to be done in C++. It seems like you keep posting the same kinds of questions and getting the same answers. I only tell you this because it is the kind of pattern that will eventually get you completely ignored. If that is not your goal, then help us help you.


Well one of the libraries was called pcuc??? some thing. It was an library was would help me to make Boxes, Lines and things like that in C++. and the other libraries I check out cost TOO MUCH. I couldn't find any thing for less then $300. and as for the free ones. I can't get support for them. Its like if you follow the doc's to install it and then you try a sample that they have and then it doesn't work. Well its like no one cares if it working or not.




This topic is closed to new replies.

Advertisement