How to email a simple plain text on windows form application
Post your questions regarding programming in C++ in here.
I using visual studio 2010 C++ Windows form application with net framework 4 and I want to send a simple text email without any login requirement. The code will read the text in richtextbox1 and email it to my email. which is custom email for example : example@custom.com
I know how to do it in VB.NET and eventually C#, but not C++ :(
LMAOSHMSFOAIDMT
Laughing my a** of so hard my sombrero fell off and I dropped my taco lmao;
Over 30 projects with source code!
Please give reputation to helpful members!
![Image]()
![Image]()
Laughing my a** of so hard my sombrero fell off and I dropped my taco lmao;
Over 30 projects with source code!
Please give reputation to helpful members!

Can you do a search for me, I'm doing a search for 13 hours, did you use SMTP to send email?
SMTP is the simplest way of sending mail. You can use this:
Code: Select all
using namespace System::Net::Mail;
Code: Select all
private: System::Void btnSend_Click(System::Object^ sender, System::EventArgs^ e) {
SmtpClient^ sc = gcnew SmtpClient();
sc->Host = "localhost";
sc->Port = 25;
MailMessage^ mm = gcnew MailMessage();
mm->From = gcnew MailAddress("user@source");
mm->To->Add(gcnew MailAddress("example@custom.com"));
mm->Body = richTextBox1->Text;
sc->Send(mm);
}
Hi again your code compiles fin however when i click the button to send it i get this error: An unhandled exception of type 'System.Net.Mail.SmtpException' occurred in System.dll
emreozpalamutcu wrote:Hi again your code compiles fin however when i click the button to send it i get this error: An unhandled exception of type 'System.Net.Mail.SmtpException' occurred in System.dllshow him/us your code so we can see if you have done something wrong
it's the code above the one mandai posted
emreozpalamutcu wrote:it's the code above the one mandai postedwell im sure youll have to change the host etc.
also check if por 25 is open @ http://www.yougetsignal.com/tools/open-ports/ but im sure it doesnt need to be opened...
I know that SMTP is port 25 it says it on the website to and it's closed from my ip and i don't know how to open it and it might be the host any suggestions
I just realised i can right anything on the ip bit and i wrote local host with port 25 and it's open any other ideas.
Copyright Information
Copyright © Codenstuff.com 2020 - 2023