How to email a simple plain text on windows form application

Post your questions regarding programming in C++ in here.
22 posts Page 2 of 3
Contributors
User avatar
mandai
Coding God
Coding God
Posts: 2585
Joined: Mon Apr 26, 2010 6:51 pm

localhost is just an example. You need to fill out the hostname of a valid SMTP server. Check with your mail provider for more information.
User avatar
emreozpalamutcu
New Member
New Member
Posts: 15
Joined: Wed Jun 22, 2011 6:43 pm

It kind of worked but i think it's the settings of my domain just to make sure can you check this error

An unhandled exception of type 'System.Net.Mail.SmtpException' occurred in System.dll

Additional information: Mailbox unavailable. The server response was: Access denied - Invalid HELO name (See RFC2821 4.1.1.1)
User avatar
Snyper345
VIP - Donator
VIP - Donator
Posts: 471
Joined: Mon Nov 01, 2010 1:53 am

emreozpalamutcu wrote:
It kind of worked but i think it's the settings of my domain just to make sure can you check this error

An unhandled exception of type 'System.Net.Mail.SmtpException' occurred in System.dll

Additional information: Mailbox unavailable. The server response was: Access denied - Invalid HELO name (See RFC2821 4.1.1.1)

try smtp.live.com as your host
Image
Image
User avatar
emreozpalamutcu
New Member
New Member
Posts: 15
Joined: Wed Jun 22, 2011 6:43 pm

now i get this error

An unhandled exception of type 'System.Net.Mail.SmtpException' occurred in System.dll

Additional information: The SMTP server requires a secure connection or the client was not authenticated. The server response was: 5.7.0 Must issue a STARTTLS command first
User avatar
mandai
Coding God
Coding God
Posts: 2585
Joined: Mon Apr 26, 2010 6:51 pm

This error means the SMTP server that you are using requires authentication.
You can enter your username/password details with this code.
Code: Select all
sc->Credentials = gcnew System::Net::NetworkCredential("user", "pass");
You may also need to set sc->EnableSsl to true.
Once again, check with your mail provider as they can tell you what the right security settings will be.
User avatar
Snyper345
VIP - Donator
VIP - Donator
Posts: 471
Joined: Mon Nov 01, 2010 1:53 am

yeah ssl is required for the live smpt server same with tls
Image
Image
User avatar
emreozpalamutcu
New Member
New Member
Posts: 15
Joined: Wed Jun 22, 2011 6:43 pm

sorry can you just explain that you mean I have to have security, authentication ?
User avatar
Snyper345
VIP - Donator
VIP - Donator
Posts: 471
Joined: Mon Nov 01, 2010 1:53 am

emreozpalamutcu wrote:
sorry can you just explain that you mean I have to have security, authentication ?
for smpt.live.com you will to enter a username(email) and password for authentication but you need a registered email if you do not just go to http://urlm.in/ibsg , sorry had to shrink url it was too long
Image
Image
User avatar
mandai
Coding God
Coding God
Posts: 2585
Joined: Mon Apr 26, 2010 6:51 pm

In order to connect to certain SMTP servers you will need a user name and password (usually given when you register an account with the provider). Without authentication anyone could use the server to send spam emails.
User avatar
emreozpalamutcu
New Member
New Member
Posts: 15
Joined: Wed Jun 22, 2011 6:43 pm

Okay but I don't want to ask the users who is using my program for there authentication and how could I do this can I just use my details to send the messages to my support email if yes what is the code for it

thank you
22 posts Page 2 of 3
Return to “General coding help”