Cheat Engine Forum Index Cheat Engine
The Official Site of Cheat Engine
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


Question - How do I send an e-mail using C#?

 
Post new topic   This topic is locked: you cannot edit posts or make replies.    Cheat Engine Forum Index -> General programming
View previous topic :: View next topic  
Author Message
Benji
Random spam moderator
Reputation: 4

Joined: 31 Dec 2007
Posts: 61
Location: The Netherlands

PostPosted: Sat Jan 23, 2010 9:42 am    Post subject: Question - How do I send an e-mail using C#? Reply with quote

I just made a fake hack for Lockerz. You need to enter your e-mail and sign up blahblahblah. Now my question is; how do you make it send an e-mail that sends the content of a TextBox to my e-mail?

I'll +rep the golden answer.

EDIT:
I attached a screenshot of my 'hack'.

Also, could you please keep it simple, I'm still a total noob at C#.

_________________
Back to top
View user's profile Send private message
Odecey
Master Cheater
Reputation: 1

Joined: 19 Apr 2007
Posts: 259
Location: Scandinavia

PostPosted: Sat Jan 23, 2010 11:32 am    Post subject: Reply with quote

This is an extensively covered subject which you would have found an answer to very easily if you had searched for it. I know this because a simple search for "send email C# gmail" gave me this piece of code:
Code:

using System.Net.Mail;
using System.Net;

            var fromAddress = new MailAddress("[email protected]", "From Name");
            var toAddress = new MailAddress("[email protected]", "To Name");
            const string fromPassword = "password";
            const string subject = "test";
            const string body = "Hey now!!";

            var smtp = new SmtpClient
            {
                Host = "smtp.gmail.com",
                Port = 587,
                EnableSsl = true,
                DeliveryMethod = SmtpDeliveryMethod.Network,
                Credentials = new NetworkCredential(fromAddress.Address, fromPassword),
                Timeout = 20000
            };
            using (var message = new MailMessage(fromAddress, toAddress)
            {
                Subject = subject,
                Body = body
            })
            {
                smtp.Send(message);
            }

If you are looking for more information related to emails in .NET, this site seems like a good place to start.

_________________
Never confuse activity with productivity. You can be busy without a purpose, but what's the point?- Rick Warren
Back to top
View user's profile Send private message MSN Messenger
Benji
Random spam moderator
Reputation: 4

Joined: 31 Dec 2007
Posts: 61
Location: The Netherlands

PostPosted: Sat Jan 23, 2010 2:02 pm    Post subject: Reply with quote

Odecey wrote:
This is an extensively covered subject which you would have found an answer to very easily if you had searched for it. I know this because a simple search for "send email C# gmail" gave me this piece of code:
Code:

using System.Net.Mail;
using System.Net;

            var fromAddress = new MailAddress("[email protected]", "From Name");
            var toAddress = new MailAddress("[email protected]", "To Name");
            const string fromPassword = "password";
            const string subject = "test";
            const string body = "Hey now!!";

            var smtp = new SmtpClient
            {
                Host = "smtp.gmail.com",
                Port = 587,
                EnableSsl = true,
                DeliveryMethod = SmtpDeliveryMethod.Network,
                Credentials = new NetworkCredential(fromAddress.Address, fromPassword),
                Timeout = 20000
            };
            using (var message = new MailMessage(fromAddress, toAddress)
            {
                Subject = subject,
                Body = body
            })
            {
                smtp.Send(message);
            }

If you are looking for more information related to emails in .NET, this site seems like a good place to start.

Alright, so I put it on my button and I tried it out. It worked and I got that body sent to my mail, but that's not what I wanted. I want it to send the content of textBox1 to my email. I already tried changing "const string body = "Hey now!!";" to "const string body = textBox1;" but now I get the error "Cannot implicitly convert type 'System.Windows.Forms.TextBox' to 'String'.
What now?

EDIT:
I got it.
Requesting lock.

_________________
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   This topic is locked: you cannot edit posts or make replies.    Cheat Engine Forum Index -> General programming All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group

CE Wiki   IRC (#CEF)   Twitter
Third party websites