Jump to content

Photo

Email C#: Help Please.


  • Please log in to reply
11 replies to this topic

#1 Delta22

Delta22

    Kilobyte

  • Members
  • 139 posts
  • LocationAustralia

Posted 22 February 2013 - 02:41 AM

Hello, i'd really appreciate the help, im trying to receive emails through C#, is there any easy way?
Please Help.

Programmer(in training), hacker(in minimal training), good with computers and mature, all you need to know about me but feel free to talk to me, contact me or whatever, i am no danger.


#2 Guest_ElatedOwl_*

Guest_ElatedOwl_*
  • Guests

Posted 22 February 2013 - 08:57 AM

You need to set up an IMAP or POP3 interface to the server you're trying to get the e-mail from.
This is a pretty common task, google should reveal plenty of solutions.

#3 Delta22

Delta22

    Kilobyte

  • Members
  • 139 posts
  • LocationAustralia

Posted 22 February 2013 - 03:17 PM

You need to set up an IMAP or POP3 interface to the server you're trying to get the e-mail from.
This is a pretty common task, google should reveal plenty of solutions.

yes but im looking for an easy code, google does give me simple and easy. it only gives me advanced code.

Programmer(in training), hacker(in minimal training), good with computers and mature, all you need to know about me but feel free to talk to me, contact me or whatever, i am no danger.


#4 Guest_ElatedOwl_*

Guest_ElatedOwl_*
  • Guests

Posted 22 February 2013 - 03:19 PM

If you're not willing to play around with "advanced code" to take the time to understand it who's going to want to help you? :/

#5 Delta22

Delta22

    Kilobyte

  • Members
  • 139 posts
  • LocationAustralia

Posted 22 February 2013 - 03:24 PM

i am willing to take the time but the thing is how will i understand "advaced code" if i cant understand basic code.?
edit: if you give me advanced and it explains what happens then yes but google doesnt give me that or i havent found it.

Programmer(in training), hacker(in minimal training), good with computers and mature, all you need to know about me but feel free to talk to me, contact me or whatever, i am no danger.


#6 Guest_ElatedOwl_*

Guest_ElatedOwl_*
  • Guests

Posted 22 February 2013 - 03:29 PM

What parts of it don't you understand? What have you tried?

#7 Delta22

Delta22

    Kilobyte

  • Members
  • 139 posts
  • LocationAustralia

Posted 22 February 2013 - 03:50 PM

What parts of it don't you understand? What have you tried?


http://www.codeproje...MailClient.aspx
this i've tried, couldnt find form type only console.
if you dont want to help then dont, but im trying to learn, not just copy, paste.
when i asked about sending an email, yes i could of sended one but i didnt understand and with the code you sent through, i understood and learnt from that.
i'd really like it if you can help but if you're not going to then stop judging me.

Programmer(in training), hacker(in minimal training), good with computers and mature, all you need to know about me but feel free to talk to me, contact me or whatever, i am no danger.


#8 Guest_ElatedOwl_*

Guest_ElatedOwl_*
  • Guests

Posted 22 February 2013 - 03:59 PM

I'm not judging you, I'm just telling you I can't help you if you don't tell me what specifically isn't working for you. (nor can anyone else unless they're going to write all the code for you which isn't going to help you learn)

It sounds like you're having trouble understanding how the language in general works. I would honestly recommend picking up a book, it will make your life a lot easier.

#9 Delta22

Delta22

    Kilobyte

  • Members
  • 139 posts
  • LocationAustralia

Posted 22 February 2013 - 08:33 PM

I'm not judging you, I'm just telling you I can't help you if you don't tell me what specifically isn't working for you. (nor can anyone else unless they're going to write all the code for you which isn't going to help you learn)

It sounds like you're having trouble understanding how the language in general works. I would honestly recommend picking up a book, it will make your life a lot easier.

im not going to lie, i am fairly new to c# but i have done a few projects from a book and some on my own, but this is basic easy stuff that i can understand, not this advanced difficult things. i understood the sending of an email its the receiving part that bothers me.
i understand this is basically what makes it all happen to send an email.
smtp.Send(mess);
but i cant just change it to
smtp.Receive(mess);
that is the part im having trouble with understanding.

Programmer(in training), hacker(in minimal training), good with computers and mature, all you need to know about me but feel free to talk to me, contact me or whatever, i am no danger.


#10 Champion of Cyrodiil

Champion of Cyrodiil

    Gigabyte

  • Members
  • 776 posts
  • LocationVirginia

Posted 25 February 2013 - 09:35 AM

The first thing you need to do is understand the APPLICATION layer of what you are trying to accomplish. (See OSI Model).
The IMAP protocol already has a predefined methods. You dont need to read the entire spec, but you should glance through it to get an idea of how it works. (http://james.apache....ap4/rfc2060.txt)

the first google response with looking up c# & imap is: http://www.codeproje...ing-C#_comments

"I have written an IMAP client library which allows basic functionalities like login, select/examine folder, search messages, fetch message (Header, Body), get storage quota, and logout."

From what that comment says, it looks like you need to do the following:
1.) Login(user, password, etc...)
2.) select/examine folder - From what i see in the comments you should be able to obtain a unique identifier (uid) for each message.
3.) fetch message - you will want both the header (to extrapolate sender information) and body. I believe you will need to use the uid with this method.

I have not touched c# since 2008, and I don't have time to play with the code to create a 'snippet' for you. nevertheless, hope this helped.

#11 Champion of Cyrodiil

Champion of Cyrodiil

    Gigabyte

  • Members
  • 776 posts
  • LocationVirginia

Posted 25 February 2013 - 09:38 AM

also it is in my opinion that imap is superior to pop3.

#12 Champion of Cyrodiil

Champion of Cyrodiil

    Gigabyte

  • Members
  • 776 posts
  • LocationVirginia

Posted 25 February 2013 - 10:23 AM

also you will want to store some of the email messages in some kind of local cache if using IMAP. (maybe 10 most recent message w/o attachments) Otherwise they wont be available when your connection to the server is down. Myabe not... depends on what your doing.