Click here to Skip to main content
15,898,990 members
Home / Discussions / C#
   

C#

 
Questionmail delete from pop3 mail server using C# Pin
khosnur6-Sep-09 22:27
khosnur6-Sep-09 22:27 
AnswerRe: mail delete from pop3 mail server using C# Pin
monstale6-Sep-09 22:45
monstale6-Sep-09 22:45 
GeneralRe: mail delete from pop3 mail server using C# Pin
khosnur6-Sep-09 22:50
khosnur6-Sep-09 22:50 
AnswerRe: mail delete from pop3 mail server using C# Pin
monstale6-Sep-09 22:55
monstale6-Sep-09 22:55 
GeneralRe: mail delete from pop3 mail server using C# Pin
khosnur6-Sep-09 22:59
khosnur6-Sep-09 22:59 
GeneralRe: mail delete from pop3 mail server using C# Pin
khosnur6-Sep-09 23:03
khosnur6-Sep-09 23:03 
AnswerRe: mail delete from pop3 mail server using C# Pin
monstale6-Sep-09 23:05
monstale6-Sep-09 23:05 
GeneralRe: mail delete from pop3 mail server using C# Pin
khosnur6-Sep-09 23:14
khosnur6-Sep-09 23:14 
//my method it works but mail is not deleted
Spartan.Net.Mail.POP3 objPOP = new Spartan.Net.Mail.POP3();
objPOP.Connect(Properties.Settings.Default.POP3Server, Properties.Settings.Default.POP3Port, frmLogin._currentUser.fldUserEmail, password);
try
{
objPOP.DeleteMessage(_ReceiveMailNumber);
return true;
}
catch(Exception ex)
{
XtraMessageBox.Show(ex.Message.ToString());
return false;
}


//connection code
public MAIL_ERROR Connect(string host, int port, string username, string password)
{
try
{
_conn.Host = host;
_conn.Port = port;
_conn.Connect();
System.Threading.Thread.Sleep(_TimeOut);
return Login(username, password);
}
catch (Exception e)
{
System.Diagnostics.Trace.Write(e.ToString());
return MAIL_ERROR.ERROR_CANTCONNECT;
}
}

//i send mail receive number
public MAIL_ERROR DeleteMessage(int id)
{
if (this._state != POP3_STATE.POP3_LOGGEDIN)
{
throw new MailException("You are not logged into the mail server");
}
string ret = "";
SendCommandSynchronous(string.Format("DELE {0}\r\n", id), out ret, false);

if (ret.Contains("OK") == false)
{
throw new MailException(ret);
}
else
{
return MAIL_ERROR.ERROR_NONE;
}
}

private MAIL_ERROR SendCommandSynchronous(string cmd, out string response, bool bMultiLineResponse)
{

// Remove any data that was left over on the buffer
string deadData = _conn.Receive();
_conn.Send(cmd);

response = WaitForResponse(bMultiLineResponse);
return MAIL_ERROR.ERROR_NONE;
}
private string WaitForResponse(bool bMultiLine)
{
int timeout = 5000; // wait 10 seconds for response

int waitedTime = 0;
string strRet = "";
while (waitedTime < timeout)
{
System.Threading.Thread.Sleep(_TimeOut);
strRet += _conn.Receive();

if (CommandComplete(strRet, bMultiLine) == true)
{
return strRet;
}
waitedTime += _TimeOut;

}
return strRet;
}
GeneralRe: mail delete from pop3 mail server using C# Pin
Christian Graus6-Sep-09 23:05
protectorChristian Graus6-Sep-09 23:05 
GeneralRe: mail delete from pop3 mail server using C# Pin
khosnur6-Sep-09 23:21
khosnur6-Sep-09 23:21 
GeneralRe: mail delete from pop3 mail server using C# Pin
Christian Graus6-Sep-09 23:23
protectorChristian Graus6-Sep-09 23:23 
GeneralRe: mail delete from pop3 mail server using C# Pin
khosnur6-Sep-09 23:28
khosnur6-Sep-09 23:28 
GeneralRe: mail delete from pop3 mail server using C# Pin
Christian Graus6-Sep-09 23:46
protectorChristian Graus6-Sep-09 23:46 
GeneralRe: mail delete from pop3 mail server using C# Pin
khosnur6-Sep-09 23:58
khosnur6-Sep-09 23:58 
GeneralRe: mail delete from pop3 mail server using C# Pin
khosnur7-Sep-09 0:25
khosnur7-Sep-09 0:25 
RantRe: mail delete from pop3 mail server using C# Pin
Keith Barrow6-Sep-09 23:46
professionalKeith Barrow6-Sep-09 23:46 
GeneralRe: mail delete from pop3 mail server using C# Pin
khosnur6-Sep-09 23:54
khosnur6-Sep-09 23:54 
QuestionHow can i get the temperature of the cpu? Pin
bonzaiholding6-Sep-09 22:00
bonzaiholding6-Sep-09 22:00 
AnswerRe: How can i get the temperature of the cpu? Pin
stancrm6-Sep-09 22:05
stancrm6-Sep-09 22:05 
GeneralRe: How can i get the temperature of the cpu? Pin
OriginalGriff6-Sep-09 22:27
mveOriginalGriff6-Sep-09 22:27 
AnswerRe: How can i get the temperature of the cpu? [modified] Pin
OriginalGriff6-Sep-09 22:32
mveOriginalGriff6-Sep-09 22:32 
QuestionInsert Hyperlink inside Rich Text Box in C#.NET Pin
Isaac Gordon6-Sep-09 21:53
Isaac Gordon6-Sep-09 21:53 
AnswerRe: Insert Hyperlink inside Rich Text Box in C#.NET Pin
stancrm6-Sep-09 22:03
stancrm6-Sep-09 22:03 
QuestionMaster page load error Pin
EmZan6-Sep-09 21:51
EmZan6-Sep-09 21:51 
AnswerRe: Master page load error Pin
Christian Graus6-Sep-09 22:11
protectorChristian Graus6-Sep-09 22:11 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.