1 //////////////////////////////////////////////////////////////////////
2 // Original class CFastSmtp written by
3 // christopher w. backen <immortal@cox.net>
4 // More details at: http://www.codeproject.com/KB/IP/zsmtp.aspx
7 // 1. name of the class and some functions
8 // 2. new functions added: SendData,ReceiveData and more
9 // 3. authentication added
10 // 4. attachments added
11 // introduced by Jakub Piwowarczyk
12 // More details at: http://www.codeproject.com/KB/mcpp/CSmtp.aspx
13 //////////////////////////////////////////////////////////////////////
18 #pragma warning(disable:4786)
20 //////////////////////////////////////////////////////////////////////
21 // Construction/Destruction
22 //////////////////////////////////////////////////////////////////////
26 // Initialize variables
27 m_oError
= CSMTP_NO_ERROR
;
28 m_iXPriority
= XPRIORITY_NORMAL
;
31 m_pcLocalHostName
= NULL
;
40 m_pcSMTPSrvName
= NULL
;
42 if((RecvBuf
= new char[BUFFER_SIZE
]) == NULL
)
44 m_oError
= CSMTP_LACK_OF_MEMORY
;
48 if((SendBuf
= new char[BUFFER_SIZE
]) == NULL
)
50 m_oError
= CSMTP_LACK_OF_MEMORY
;
55 WORD wVer
= MAKEWORD(2,2);
56 if (WSAStartup(wVer
,&wsaData
) != NO_ERROR
)
58 m_oError
= CSMTP_WSA_STARTUP
;
61 if (LOBYTE( wsaData
.wVersion
) != 2 || HIBYTE( wsaData
.wVersion
) != 2 )
63 m_oError
= CSMTP_WSA_VER
;
74 BCCRecipients
.clear();
78 if (m_pcLocalHostName
)
79 delete[] m_pcLocalHostName
;
81 delete[] m_pcMailFrom
;
83 delete[] m_pcNameFrom
;
95 delete[] m_pcPassword
;
105 //////////////////////////////////////////////////////////////////////
107 //////////////////////////////////////////////////////////////////////
109 bool CSmtp::AddAttachment(const char *path
)
111 std::string
str(path
);
112 Attachments
.insert(Attachments
.end(),str
);
116 bool CSmtp::AddRecipient(const char *email
, const char *name
)
122 m_oError
= CSMTP_UNDEF_RECIPENT_MAIL
;
127 recipent
.Mail
.insert(0,email
);
128 name
!=NULL
? recipent
.Name
.insert(0,name
) : recipent
.Name
.insert(0,"");
130 Recipients
.insert(Recipients
.end(), recipent
);
135 bool CSmtp::AddCCRecipient(const char *email
, const char *name
)
141 m_oError
= CSMTP_UNDEF_RECIPENT_MAIL
;
146 recipent
.Mail
.insert(0,email
);
147 name
!=NULL
? recipent
.Name
.insert(0,name
) : recipent
.Name
.insert(0,"");
149 CCRecipients
.insert(CCRecipients
.end(), recipent
);
154 bool CSmtp::AddBCCRecipient(const char *email
, const char *name
)
160 m_oError
= CSMTP_UNDEF_RECIPENT_MAIL
;
165 recipent
.Mail
.insert(0,email
);
166 name
!=NULL
? recipent
.Name
.insert(0,name
) : recipent
.Name
.insert(0,"");
168 BCCRecipients
.insert(BCCRecipients
.end(), recipent
);
175 unsigned int i
,rcpt_count
,res
,FileId
;
176 char *FileBuf
= NULL
, *FileName
= NULL
;
178 unsigned long int FileSize
,TotalSize
,MsgPart
;
180 // ***** CONNECTING TO SMTP SERVER *****
182 assert(m_pcSMTPSrvName
);
184 // connecting to remote host:
185 if( (hSocket
= ConnectRemoteServer(m_pcSMTPSrvName
, m_iSMTPSrvPort
)) == INVALID_SOCKET
)
187 m_oError
= CSMTP_WSA_INVALID_SOCKET
;
194 switch(SmtpXYZdigits())
199 m_oError
= CSMTP_SERVER_NOT_READY
;
203 // EHLO <SP> <domain> <CRLF>
204 sprintf(SendBuf
,"EHLO %s\r\n",GetLocalHostName()!=NULL
? m_pcLocalHostName
: "domain");
211 switch(SmtpXYZdigits())
216 m_oError
= CSMTP_COMMAND_EHLO
;
220 // AUTH <SP> LOGIN <CRLF>
221 strcpy(SendBuf
,"AUTH LOGIN\r\n");
228 switch(SmtpXYZdigits())
233 m_oError
= CSMTP_COMMAND_AUTH_LOGIN
;
240 m_oError
= CSMTP_UNDEF_LOGIN
;
243 std::string encoded_login
= base64_encode(reinterpret_cast<const unsigned char*>(m_pcLogin
),strlen(m_pcLogin
));
244 sprintf(SendBuf
,"%s\r\n",encoded_login
.c_str());
251 switch(SmtpXYZdigits())
256 m_oError
= CSMTP_UNDEF_XYZ_RESPOMSE
;
263 m_oError
= CSMTP_UNDEF_PASSWORD
;
266 std::string encoded_password
= base64_encode(reinterpret_cast<const unsigned char*>(m_pcPassword
),strlen(m_pcPassword
));
267 sprintf(SendBuf
,"%s\r\n",encoded_password
.c_str());
274 switch(SmtpXYZdigits())
279 m_oError
= CSMTP_BAD_LOGIN_PASS
;
282 m_oError
= CSMTP_UNDEF_XYZ_RESPOMSE
;
286 // ***** SENDING E-MAIL *****
288 // MAIL <SP> FROM:<reverse-path> <CRLF>
289 if(m_pcMailFrom
== NULL
)
291 m_oError
= CSMTP_UNDEF_MAILFROM
;
294 sprintf(SendBuf
,"MAIL FROM:<%s>\r\n",m_pcMailFrom
);
301 switch(SmtpXYZdigits())
306 m_oError
= CSMTP_COMMAND_MAIL_FROM
;
310 // RCPT <SP> TO:<forward-path> <CRLF>
311 rcpt_count
= Recipients
.size();
312 for(i
=0;i
<Recipients
.size();i
++)
314 sprintf(SendBuf
,"RCPT TO:<%s>\r\n",(Recipients
.at(i
).Mail
).c_str());
321 switch(SmtpXYZdigits())
326 m_oError
= CSMTP_COMMAND_RCPT_TO
;
332 for(i
=0;i
<CCRecipients
.size();i
++)
334 sprintf(SendBuf
,"RCPT TO:<%s>\r\n",(CCRecipients
.at(i
).Mail
).c_str());
341 for(i
=0;i
<BCCRecipients
.size();i
++)
343 sprintf(SendBuf
,"RCPT TO:<%s>\r\n",(BCCRecipients
.at(i
).Mail
).c_str());
352 strcpy(SendBuf
,"DATA\r\n");
359 switch(SmtpXYZdigits())
364 m_oError
= CSMTP_COMMAND_DATA
;
369 if(!FormatHeader(SendBuf
))
371 m_oError
= CSMTP_UNDEF_MSG_HEADER
;
378 sprintf(SendBuf
,"%s\r\n",m_pcMsgBody
); // NOTICE: each line ends with <CRLF>
382 // next goes attachments (if they are)
383 if((FileBuf
= new char[55]) == NULL
)
385 m_oError
= CSMTP_LACK_OF_MEMORY
;
388 if((FileName
= new char[255]) == NULL
)
390 m_oError
= CSMTP_LACK_OF_MEMORY
;
394 for(FileId
=0;FileId
<Attachments
.size();FileId
++)
396 strcpy(FileName
,Attachments
[FileId
].c_str());
398 sprintf(SendBuf
,"--%s\r\n",BOUNDARY_TEXT
);
399 strcat(SendBuf
,"Content-Type: application/x-msdownload; name=\"");
400 strcat(SendBuf
,&FileName
[Attachments
[FileId
].find_last_of("\\") + 1]);
401 strcat(SendBuf
,"\"\r\n");
402 strcat(SendBuf
,"Content-Transfer-Encoding: base64\r\n");
403 strcat(SendBuf
,"Content-Disposition: attachment; filename=\"");
404 strcat(SendBuf
,&FileName
[Attachments
[FileId
].find_last_of("\\") + 1]);
405 strcat(SendBuf
,"\"\r\n");
406 strcat(SendBuf
,"\r\n");
412 hFile
= fopen(FileName
,"rb");
415 m_oError
= CSMTP_FILE_NOT_EXIST
;
419 // checking file size:
422 FileSize
+= fread(FileBuf
,sizeof(char),54,hFile
);
423 TotalSize
+= FileSize
;
426 if(TotalSize
/1024 > MSG_SIZE_IN_MB
*1024)
427 m_oError
= CSMTP_MSG_TOO_BIG
;
430 fseek (hFile
,0,SEEK_SET
);
433 for(i
=0;i
<FileSize
/54+1;i
++)
435 res
= fread(FileBuf
,sizeof(char),54,hFile
);
436 MsgPart
? strcat(SendBuf
,base64_encode(reinterpret_cast<const unsigned char*>(FileBuf
),res
).c_str())
437 : strcpy(SendBuf
,base64_encode(reinterpret_cast<const unsigned char*>(FileBuf
),res
).c_str());
438 strcat(SendBuf
,"\r\n");
440 if(MsgPart
>= BUFFER_SIZE
/2)
441 { // sending part of the message
468 // sending last message block (if there is one or more attachments)
469 if(Attachments
.size())
471 sprintf(SendBuf
,"\r\n--%s--\r\n",BOUNDARY_TEXT
);
477 strcpy(SendBuf
,"\r\n.\r\n");
484 switch(SmtpXYZdigits())
489 m_oError
= CSMTP_MSG_BODY_ERROR
;
493 // ***** CLOSING CONNECTION *****
496 strcpy(SendBuf
,"QUIT\r\n");
503 switch(SmtpXYZdigits())
508 m_oError
= CSMTP_COMMAND_QUIT
;
513 closesocket(hSocket
);
518 SOCKET
CSmtp::ConnectRemoteServer(const char *server
,const unsigned short port
)
523 SOCKADDR_IN sockAddr
;
524 SOCKET hServerSocket
= INVALID_SOCKET
;
527 // If the user input is an alpha name for the host, use gethostbyname()
528 // If not, get host by addr (assume IPv4)
529 if(isalpha(server
[0]))
530 lpHostEnt
= gethostbyname(server
);
533 addr
.s_addr
= inet_addr(server
);
534 if(addr
.s_addr
== INADDR_NONE
)
536 m_oError
= CSMTP_BAD_IPV4_ADDR
;
537 return INVALID_SOCKET
;
540 lpHostEnt
= gethostbyaddr((char *) &addr
, 4, AF_INET
);
543 if(lpHostEnt
!= NULL
)
545 if((hServerSocket
= socket(PF_INET
, SOCK_STREAM
,0)) != INVALID_SOCKET
)
548 nProtocolPort
= htons(port
);
551 lpServEnt
= getservbyname("mail", 0);
552 if (lpServEnt
== NULL
)
553 nProtocolPort
= htons(25);
555 nProtocolPort
= lpServEnt
->s_port
;
558 sockAddr
.sin_family
= AF_INET
;
559 sockAddr
.sin_port
= nProtocolPort
;
560 sockAddr
.sin_addr
= *((LPIN_ADDR
)*lpHostEnt
->h_addr_list
);
561 if(connect(hServerSocket
,(PSOCKADDR
)&sockAddr
,sizeof(sockAddr
)) == SOCKET_ERROR
)
563 m_oError
= CSMTP_WSA_CONNECT
;
564 hServerSocket
= INVALID_SOCKET
;
569 m_oError
= CSMTP_WSA_INVALID_SOCKET
;
570 return INVALID_SOCKET
;
575 m_oError
= CSMTP_WSA_GETHOSTBY_NAME_ADDR
;
576 return INVALID_SOCKET
;
579 return hServerSocket
;
582 int CSmtp::SmtpXYZdigits()
587 return (RecvBuf
[0]-'0')*100 + (RecvBuf
[1]-'0')*10 + RecvBuf
[2]-'0';
590 bool CSmtp::FormatHeader(char* header
)
592 unsigned int i
,s
= 0;
599 // check for at least one recipient
600 if(Recipients
.size())
602 for (i
=s
=0;i
<Recipients
.size();i
++)
603 s
+= Recipients
[i
].Mail
.size() + Recipients
[i
].Name
.size() + 3;
606 if((to
= new char[s
]) == NULL
)
608 m_oError
= CSMTP_LACK_OF_MEMORY
;
613 for (i
=0;i
<Recipients
.size();i
++)
615 i
> 0 ? strcat(to
,","):strcpy(to
,"");
616 strcat(to
,Recipients
[i
].Name
.c_str());
618 strcat(to
,Recipients
[i
].Mail
.c_str());
624 m_oError
= CSMTP_UNDEF_RECIPENTS
;
628 if(CCRecipients
.size())
630 for (i
=s
=0;i
<CCRecipients
.size();i
++)
631 s
+= CCRecipients
[i
].Mail
.size() + CCRecipients
[i
].Name
.size() + 3;
634 if((cc
= new char[s
]) == NULL
)
636 m_oError
= CSMTP_LACK_OF_MEMORY
;
642 for (i
=0;i
<CCRecipients
.size();i
++)
644 i
> 0 ? strcat(cc
,","):strcpy(cc
,"");
645 strcat(cc
,CCRecipients
[i
].Name
.c_str());
647 strcat(cc
,CCRecipients
[i
].Mail
.c_str());
652 if(BCCRecipients
.size())
654 for (i
=s
=0;i
<BCCRecipients
.size();i
++)
655 s
+= BCCRecipients
[i
].Mail
.size() + BCCRecipients
[i
].Name
.size() + 3;
658 if((bcc
= new char[s
]) == NULL
)
660 m_oError
= CSMTP_LACK_OF_MEMORY
;
667 for (i
=0;i
<BCCRecipients
.size();i
++)
669 i
> 0 ? strcat(bcc
,","):strcpy(bcc
,"");
670 strcat(bcc
,BCCRecipients
[i
].Name
.c_str());
672 strcat(bcc
,BCCRecipients
[i
].Mail
.c_str());
677 // Date: <SP> <dd> <SP> <mon> <SP> <yy> <SP> <hh> ":" <mm> ":" <ss> <SP> <zone> <CRLF>
679 ::GetSystemTime(&st
);
680 ::GetDateFormatA(MAKELCID(0x0409,SORT_DEFAULT
),0,&st
,"ddd\',\' dd MMM yyyy",szDate
,sizeof(szDate
));
681 ::GetTimeFormatA(MAKELCID(0x0409,SORT_DEFAULT
),TIME_FORCE24HOURFORMAT
,&st
,"HH\':\'mm\':\'ss",sztTime
,sizeof(sztTime
));
682 sprintf(header
,"Date: %s %s\r\n", szDate
, sztTime
);
684 // From: <SP> <sender> <SP> "<" <sender-email> ">" <CRLF>
685 if(m_pcMailFrom
== NULL
)
687 m_oError
= CSMTP_UNDEF_MAILFROM
;
693 strcat(header
,"From: ");
695 strcat(header
, m_pcNameFrom
);
697 strcat(header
,m_pcMailFrom
);
698 strcat(header
, ">\r\n");
700 // X-Mailer: <SP> <xmailer-app> <CRLF>
701 if (m_pcXMailer
!= NULL
)
703 strcat(header
,"X-Mailer: ");
704 strcat(header
, m_pcXMailer
);
705 strcat(header
, "\r\n");
708 // Reply-To: <SP> <reverse-path> <CRLF>
709 if(m_pcReplyTo
!= NULL
)
711 strcat(header
, "Reply-To: ");
712 strcat(header
, m_pcReplyTo
);
713 strcat(header
, "\r\n");
716 // X-Priority: <SP> <number> <CRLF>
720 strcat(header
,"X-Priority: 2 (High)\r\n");
722 case XPRIORITY_NORMAL
:
723 strcat(header
,"X-Priority: 3 (Normal)\r\n");
726 strcat(header
,"X-Priority: 4 (Low)\r\n");
729 strcat(header
,"X-Priority: 3 (Normal)\r\n");
732 // To: <SP> <remote-user-mail> <CRLF>
733 strcat(header
,"To: ");
735 strcat(header
, "\r\n");
737 // Cc: <SP> <remote-user-mail> <CRLF>
738 if(CCRecipients
.size())
740 strcat(header
,"Cc: ");
742 strcat(header
, "\r\n");
745 if(BCCRecipients
.size())
747 strcat(header
,"Bcc: ");
749 strcat(header
, "\r\n");
752 // Subject: <SP> <subject-text> <CRLF>
753 if(m_pcSubject
== NULL
)
755 m_oError
= CSMTP_UNDEF_SUBJECT
;
756 strcat(header
, "Subject: ");
760 strcat(header
, "Subject: ");
761 strcat(header
, m_pcSubject
);
763 strcat(header
, "\r\n");
765 // MIME-Version: <SP> 1.0 <CRLF>
766 strcat(header
,"MIME-Version: 1.0\r\n");
767 if(!Attachments
.size())
769 strcat(header
,"Content-type: text/plain; charset=US-ASCII\r\n");
770 strcat(header
,"Content-Transfer-Encoding: 7bit\r\n");
771 strcat(SendBuf
,"\r\n");
774 { // there is one or more attachments
775 strcat(header
,"Content-Type: multipart/mixed; boundary=\"");
776 strcat(header
,BOUNDARY_TEXT
);
777 strcat(header
,"\"\r\n");
778 strcat(header
,"\r\n");
779 // first goes text message
780 strcat(SendBuf
,"--");
781 strcat(SendBuf
,BOUNDARY_TEXT
);
782 strcat(SendBuf
,"\r\n");
783 strcat(SendBuf
,"Content-type: text/plain; charset=US-ASCII\r\n");
784 strcat(SendBuf
,"Content-Transfer-Encoding: 7bit\r\n");
785 strcat(SendBuf
,"\r\n");
797 bool CSmtp::ReceiveData()
806 if( (res
= recv(hSocket
,RecvBuf
,BUFFER_SIZE
,0)) == SOCKET_ERROR
)
808 m_oError
= CSMTP_WSA_RECV
;
813 m_oError
= CSMTP_CONNECTION_CLOSED
;
821 bool CSmtp::SendData()
825 int idx
= 0,res
,nLeft
= strlen(SendBuf
);
828 if( res
= send(hSocket
,&SendBuf
[idx
],nLeft
,0) == SOCKET_ERROR
)
830 m_oError
= CSMTP_WSA_SEND
;
841 CSmtpError
CSmtp::GetLastError()
847 const char* const CSmtp::GetLocalHostIP()
849 in_addr *iaHost = NULL;
855 if(gethostname(m_pcHostName,255) != SOCKET_ERROR)
857 pHe = gethostbyname(m_pcHostName);
860 for (int i=0;pHe->h_addr_list[i] != 0;i++)
862 iaHost = (LPIN_ADDR)pHe->h_addr_list[i];
863 m_pcIPAddr = inet_ntoa(*iaHost);
869 m_oError = CSMTP_WSA_GETHOSTBY_NAME_ADDR;
877 const char* const CSmtp::GetLocalHostName()
879 if(m_pcLocalHostName
)
880 delete[] m_pcLocalHostName
;
881 if((m_pcLocalHostName
= new char[255]) == NULL
)
883 m_oError
= CSMTP_LACK_OF_MEMORY
;
886 if(gethostname((char FAR
*)m_pcLocalHostName
,255) == SOCKET_ERROR
)
887 m_oError
= CSMTP_WSA_HOSTNAME
;
888 return m_pcLocalHostName
;
891 unsigned const int CSmtp::GetBCCRecipientCount()
893 return BCCRecipients
.size();
896 unsigned const int CSmtp::GetCCRecipientCount()
898 return CCRecipients
.size();
901 const char* const CSmtp::GetMessageBody()
906 unsigned const int CSmtp::GetRecipientCount()
908 return Recipients
.size();
911 const char* const CSmtp::GetReplyTo()
916 const char* const CSmtp::GetMailFrom()
921 const char* const CSmtp::GetSenderName()
926 const char* const CSmtp::GetSubject()
931 const char* const CSmtp::GetXMailer()
936 CSmptXPriority
CSmtp::GetXPriority()
941 void CSmtp::SetXPriority(CSmptXPriority priority
)
943 m_iXPriority
= priority
;
946 void CSmtp::SetMessageBody(const char *body
)
949 int s
= strlen(body
);
951 delete[] m_pcMsgBody
;
952 if((m_pcMsgBody
= new char[s
+1]) == NULL
)
954 m_oError
= CSMTP_LACK_OF_MEMORY
;
957 strcpy(m_pcMsgBody
, body
);
960 void CSmtp::SetReplyTo(const char *replyto
)
963 int s
= strlen(replyto
);
965 delete[] m_pcReplyTo
;
966 if((m_pcReplyTo
= new char[s
+1]) == NULL
)
968 m_oError
= CSMTP_LACK_OF_MEMORY
;
971 strcpy(m_pcReplyTo
, replyto
);
974 void CSmtp::SetSenderMail(const char *email
)
977 int s
= strlen(email
);
979 delete[] m_pcMailFrom
;
980 if((m_pcMailFrom
= new char[s
+1]) == NULL
)
982 m_oError
= CSMTP_LACK_OF_MEMORY
;
985 strcpy(m_pcMailFrom
, email
);
988 void CSmtp::SetSenderName(const char *name
)
991 int s
= strlen(name
);
993 delete[] m_pcNameFrom
;
994 if((m_pcNameFrom
= new char[s
+1]) == NULL
)
996 m_oError
= CSMTP_LACK_OF_MEMORY
;
999 strcpy(m_pcNameFrom
, name
);
1002 void CSmtp::SetSubject(const char *subject
)
1005 int s
= strlen(subject
);
1007 delete[] m_pcSubject
;
1008 m_pcSubject
= new char[s
+1];
1009 strcpy(m_pcSubject
, subject
);
1012 void CSmtp::SetXMailer(const char *xmailer
)
1015 int s
= strlen(xmailer
);
1017 delete[] m_pcXMailer
;
1018 if((m_pcXMailer
= new char[s
+1]) == NULL
)
1020 m_oError
= CSMTP_LACK_OF_MEMORY
;
1023 strcpy(m_pcXMailer
, xmailer
);
1026 void CSmtp::SetLogin(const char *login
)
1029 int s
= strlen(login
);
1032 if((m_pcLogin
= new char[s
+1]) == NULL
)
1034 m_oError
= CSMTP_LACK_OF_MEMORY
;
1037 strcpy(m_pcLogin
, login
);
1040 void CSmtp::SetPassword(const char *password
)
1043 int s
= strlen(password
);
1045 delete[] m_pcPassword
;
1046 if((m_pcPassword
= new char[s
+1]) == NULL
)
1048 m_oError
= CSMTP_LACK_OF_MEMORY
;
1051 strcpy(m_pcPassword
, password
);
1054 void CSmtp::SetSMTPServer(const char* SrvName
,const unsigned short SrvPort
)
1057 m_iSMTPSrvPort
= SrvPort
;
1058 int s
= strlen(SrvName
);
1060 delete[] m_pcSMTPSrvName
;
1061 if((m_pcSMTPSrvName
= new char[s
+1]) == NULL
)
1063 m_oError
= CSMTP_LACK_OF_MEMORY
;
1066 strcpy(m_pcSMTPSrvName
, SrvName
);
1069 //////////////////////////////////////////////////////////////////////
1071 //////////////////////////////////////////////////////////////////////
1073 char* GetErrorText(CSmtpError ErrorId
)
1077 case CSMTP_NO_ERROR
:
1079 case CSMTP_WSA_STARTUP
:
1080 return "Unable to initialise winsock2.";
1082 return "Wrong version of the winsock2.";
1083 case CSMTP_WSA_SEND
:
1084 return "Function send() failed.";
1085 case CSMTP_WSA_RECV
:
1086 return "Function recv() failed.";
1087 case CSMTP_WSA_CONNECT
:
1088 return "Function connect failed.";
1089 case CSMTP_WSA_GETHOSTBY_NAME_ADDR
:
1090 return "Functions gethostbyname() or gethostbyaddr() failed.";
1091 case CSMTP_WSA_INVALID_SOCKET
:
1092 return "Invalid winsock2 socket.";
1093 case CSMTP_WSA_HOSTNAME
:
1094 return "Function hostname() failed.";
1095 case CSMTP_BAD_IPV4_ADDR
:
1096 return "Improper IPv4 address.";
1097 case CSMTP_UNDEF_MSG_HEADER
:
1098 return "Undefined message header.";
1099 case CSMTP_UNDEF_MAILFROM
:
1100 return "Undefined from is the mail.";
1101 case CSMTP_UNDEF_SUBJECT
:
1102 return "Undefined message subject.";
1103 case CSMTP_UNDEF_RECIPENTS
:
1104 return "Undefined at least one reciepent.";
1105 case CSMTP_UNDEF_RECIPENT_MAIL
:
1106 return "Undefined recipent mail.";
1107 case CSMTP_UNDEF_LOGIN
:
1108 return "Undefined user login.";
1109 case CSMTP_UNDEF_PASSWORD
:
1110 return "Undefined user password.";
1111 case CSMTP_COMMAND_MAIL_FROM
:
1112 return "Server returned error after sending MAIL FROM.";
1113 case CSMTP_COMMAND_EHLO
:
1114 return "Server returned error after sending EHLO.";
1115 case CSMTP_COMMAND_AUTH_LOGIN
:
1116 return "Server returned error after sending AUTH LOGIN.";
1117 case CSMTP_COMMAND_DATA
:
1118 return "Server returned error after sending DATA.";
1119 case CSMTP_COMMAND_QUIT
:
1120 return "Server returned error after sending QUIT.";
1121 case CSMTP_COMMAND_RCPT_TO
:
1122 return "Server returned error after sending RCPT TO.";
1123 case CSMTP_MSG_BODY_ERROR
:
1124 return "Error in message body";
1125 case CSMTP_CONNECTION_CLOSED
:
1126 return "Server has closed the connection.";
1127 case CSMTP_SERVER_NOT_READY
:
1128 return "Server is not ready.";
1129 case CSMTP_FILE_NOT_EXIST
:
1130 return "File not exist.";
1131 case CSMTP_MSG_TOO_BIG
:
1132 return "Message is too big.";
1133 case CSMTP_BAD_LOGIN_PASS
:
1134 return "Bad login or password.";
1135 case CSMTP_UNDEF_XYZ_RESPOMSE
:
1136 return "Undefined xyz SMTP response.";
1137 case CSMTP_LACK_OF_MEMORY
:
1138 return "Lack of memory.";
1140 return "Undefined error id.";
1144 #pragma warning(pop)