57 return IXP_E_SMTP_RESPONSE_ERROR;
59 pResponse->rIxpResult.pszResponse = pszResponse;
60 pResponse->rIxpResult.dwSocketError = 0;
61 pResponse->rIxpResult.uiServerError =
strtol(pszResponse, &pszResponse, 10);
62 pResponse->fDone = (*pszResponse !=
'-');
64 switch (pResponse->rIxpResult.uiServerError)
66 case 211: hrServerError = IXP_E_SMTP_211_SYSTEM_STATUS;
break;
67 case 214: hrServerError = IXP_E_SMTP_214_HELP_MESSAGE;
break;
68 case 220: hrServerError = IXP_E_SMTP_220_READY;
break;
69 case 221: hrServerError = IXP_E_SMTP_221_CLOSING;
break;
70 case 245: hrServerError = IXP_E_SMTP_245_AUTH_SUCCESS;
break;
71 case 250: hrServerError = IXP_E_SMTP_250_MAIL_ACTION_OKAY;
break;
72 case 251: hrServerError = IXP_E_SMTP_251_FORWARDING_MAIL;
break;
73 case 334: hrServerError = IXP_E_SMTP_334_AUTH_READY_RESPONSE;
break;
74 case 354: hrServerError = IXP_E_SMTP_354_START_MAIL_INPUT;
break;
75 case 421: hrServerError = IXP_E_SMTP_421_NOT_AVAILABLE;
break;
76 case 450: hrServerError = IXP_E_SMTP_450_MAILBOX_BUSY;
break;
77 case 451: hrServerError = IXP_E_SMTP_451_ERROR_PROCESSING;
break;
78 case 452: hrServerError = IXP_E_SMTP_452_NO_SYSTEM_STORAGE;
break;
79 case 454: hrServerError = IXP_E_SMTP_454_STARTTLS_FAILED;
break;
80 case 500: hrServerError = IXP_E_SMTP_500_SYNTAX_ERROR;
break;
81 case 501: hrServerError = IXP_E_SMTP_501_PARAM_SYNTAX;
break;
82 case 502: hrServerError = IXP_E_SMTP_502_COMMAND_NOTIMPL;
break;
83 case 503: hrServerError = IXP_E_SMTP_503_COMMAND_SEQ;
break;
84 case 504: hrServerError = IXP_E_SMTP_504_COMMAND_PARAM_NOTIMPL;
break;
85 case 530: hrServerError = IXP_E_SMTP_530_STARTTLS_REQUIRED;
break;
86 case 550: hrServerError = IXP_E_SMTP_550_MAILBOX_NOT_FOUND;
break;
87 case 551: hrServerError = IXP_E_SMTP_551_USER_NOT_LOCAL;
break;
88 case 552: hrServerError = IXP_E_SMTP_552_STORAGE_OVERFLOW;
break;
89 case 553: hrServerError = IXP_E_SMTP_553_MAILBOX_NAME_SYNTAX;
break;
90 case 554: hrServerError = IXP_E_SMTP_554_TRANSACT_FAILED;
break;
92 hrServerError = IXP_E_SMTP_RESPONSE_ERROR;
95 pResponse->rIxpResult.hrResult = hrServerError;
96 pResponse->rIxpResult.hrServerError = hrServerError;
98 if (
This->InetTransport.pCallback &&
This->InetTransport.fCommandLogging)
100 ITransportCallback_OnCommand(
This->InetTransport.pCallback, CMD_RESP,
101 pResponse->rIxpResult.pszResponse, hrServerError,
123 SMTPRESPONSE response = { 0 };
135 response.command = SMTP_DATA;
136 ISMTPCallback_OnResponse((
ISMTPCallback *)
This->InetTransport.pCallback, &response);
138 if (
FAILED(response.rIxpResult.hrServerError))
157 SMTPRESPONSE response = { 0 };
169 response.command = SMTP_MAIL;
170 ISMTPCallback_OnResponse((
ISMTPCallback *)
This->InetTransport.pCallback, &response);
172 if (
FAILED(response.rIxpResult.hrServerError))
191 SMTPRESPONSE response = { 0 };
206 response.command = SMTP_RCPT;
207 ISMTPCallback_OnResponse((
ISMTPCallback *)
This->InetTransport.pCallback, &response);
209 if (
FAILED(response.rIxpResult.hrServerError))
228 SMTPRESPONSE response = { 0 };
240 response.command =
This->fESMTP ? SMTP_EHLO : SMTP_HELO;
241 ISMTPCallback_OnResponse((
ISMTPCallback *)
This->InetTransport.pCallback, &response);
243 if (
FAILED(response.rIxpResult.hrServerError))
263 memset(&response, 0,
sizeof(response));
264 response.command = SMTP_CONNECTED;
265 response.fDone =
TRUE;
266 ISMTPCallback_OnResponse((
ISMTPCallback *)
This->InetTransport.pCallback, &response);
280 SMTPRESPONSE response = { 0 };
282 const char *pszHello;
284 static const char szHostName[] =
"localhost";
295 response.command = SMTP_BANNER;
296 ISMTPCallback_OnResponse((
ISMTPCallback *)
This->InetTransport.pCallback, &response);
298 if (
FAILED(response.rIxpResult.hrServerError))
307 This->fESMTP =
strstr(response.rIxpResult.pszResponse,
"ESMTP") &&
308 This->InetTransport.ServerInfo.dwFlags & (ISF_SSLONSAMEPORT|ISF_QUERYDSNSUPPORT|ISF_QUERYAUTHSUPPORT);
316 strcpy(pszCommand, pszHello);
317 strcat(pszCommand, szHostName);
318 pszCommand[
strlen(pszCommand)+1] =
'\0';
319 pszCommand[
strlen(pszCommand)] =
'\n';
330 SMTPRESPONSE response;
344 if (
FAILED(response.rIxpResult.hrServerError))
357 SMTPRESPONSE response = { 0 };
369 if (
FAILED(response.rIxpResult.hrServerError))
376 response.command = SMTP_SEND_MESSAGE;
377 response.rIxpResult.hrResult =
S_OK;
378 ISMTPCallback_OnResponse((
ISMTPCallback *)
This->InetTransport.pCallback, &response);
391 IStream_Release(
This->pending_message.pstmMsg);
399 SMTPRESPONSE response;
413 if (
FAILED(response.rIxpResult.hrServerError))
421 hr = IStream_Read(
This->pending_message.pstmMsg, pszBuffer,
This->pending_message.cbSize,
NULL);
427 cbSize =
This->pending_message.cbSize;
460 SMTPRESPONSE response;
472 if (
FAILED(response.rIxpResult.hrServerError))
479 for (;
This->ulCurrentAddressIndex <
This->pending_message.rAddressList.cAddress;
This->ulCurrentAddressIndex++)
481 TRACE(
"address[%d]: %s\n",
This->ulCurrentAddressIndex,
482 This->pending_message.rAddressList.prgAddress[
This->ulCurrentAddressIndex].szEmail);
486 static const char szCommandFormat[] =
"RCPT TO: <%s>\n";
488 int len =
sizeof(szCommandFormat) - 2 +
489 strlen(
This->pending_message.rAddressList.prgAddress[
This->ulCurrentAddressIndex].szEmail);
495 sprintf(szCommand, szCommandFormat,
496 This->pending_message.rAddressList.prgAddress[
This->ulCurrentAddressIndex].szEmail);
498 This->ulCurrentAddressIndex++;
529 ISMTPTransport2_AddRef(iface);
553 if (
This->InetTransport.pCallback) ITransportCallback_Release(
This->InetTransport.pCallback);
565 TRACE(
"(%p)\n", pInetServer);
578 FIXME(
"(%d): stub\n", isstate);
587 TRACE(
"(%p, %p)\n", pAccount, pInetServer);
592 LPINETSERVER pInetServer,
boolean fAuthenticate,
boolean fCommandLogging)
597 TRACE(
"(%p, %s, %s)\n", pInetServer, fAuthenticate ?
"TRUE" :
"FALSE", fCommandLogging ?
"TRUE" :
"FALSE");
618 return ISMTPTransport2_CommandQUIT(iface);
649 FIXME(
"not using log file of %s, use Wine debug logging instead\n",
654 This->InetTransport.fInitialised =
TRUE;
660 LPSMTPMESSAGE pMessage)
662 static const char szCommandFormat[] =
"MAIL FROM: <%s>\n";
670 TRACE(
"(%p)\n", pMessage);
672 This->pending_message = *pMessage;
673 IStream_AddRef(pMessage->pstmMsg);
675 size = pMessage->rAddressList.cAddress *
sizeof(
INETADDR);
681 This->pending_message.rAddressList.prgAddress =
This->addrlist;
682 This->ulCurrentAddressIndex = 0;
684 for (
i = 0;
i < pMessage->rAddressList.cAddress;
i++)
688 TRACE(
"address[%d]: ADDR_FROM, %s\n",
i,
689 pMessage->rAddressList.prgAddress[
i].szEmail);
690 pszFromAddress = pMessage->rAddressList.prgAddress[
i].szEmail;
694 TRACE(
"address[%d]: ADDR_TO, %s\n",
i,
695 pMessage->rAddressList.prgAddress[
i].szEmail);
701 SMTPRESPONSE response;
702 memset(&response, 0,
sizeof(response));
703 response.command = SMTP_SEND_MESSAGE;
704 response.fDone =
TRUE;
706 response.rIxpResult.hrResult = IXP_E_SMTP_NO_SENDER;
707 ISMTPCallback_OnResponse((
ISMTPCallback *)
This->InetTransport.pCallback, &response);
710 len =
sizeof(szCommandFormat) - 2 +
strlen(pszFromAddress);
716 sprintf(szCommand, szCommandFormat, pszFromAddress);
726 static const char szCommandFormat[] =
"MAIL FROM: <%s>\n";
737 len =
sizeof(szCommandFormat) - 2 +
strlen(pszEmailFrom);
742 sprintf(szCommand, szCommandFormat, pszEmailFrom);
753 static const char szCommandFormat[] =
"RCPT TO: <%s>\n";
764 len =
sizeof(szCommandFormat) - 2 +
strlen(pszEmailTo);
769 sprintf(szCommand, szCommandFormat, pszEmailTo);
780 static const char szCommandFormat[] =
"EHLO %s\n";
804 static const char szCommandFormat[] =
"HELO %s\n";
829 static const char szCommandFormat[] =
"AUTH %s\n";
840 len =
sizeof(szCommandFormat) - 2 +
strlen(pszAuthType);
845 sprintf(szCommand, szCommandFormat, pszAuthType);
894 FIXME(
"(%p, %d)\n", pStream, cbSize);
912 FIXME(
"(%p)\n", pMessage);
919 FIXME(
"(%s, %u)\n", pszEmailTo, atDSN);
973 ISMTPTransport_AddRef(*ppTransport);
986 IClassFactory_AddRef(iface);
1019 hr = ISMTPTransport_QueryInterface(pSmtpTransport,
riid,
ppv);
1020 ISMTPTransport_Release(pSmtpTransport);
1027 FIXME(
"(%d)\n",fLock);
static const WCHAR szHostname[]
char * strstr(char *String1, char *String2)
ACPI_SIZE strlen(const char *String)
#define InterlockedIncrement
#define InterlockedDecrement
#define WINE_DEFAULT_DEBUG_CHANNEL(t)
const GUID IID_IClassFactory
#define HeapFree(x, y, z)
static void *static void *static LPDIRECTPLAY IUnknown * pUnk
FxPnpStateCallbackInfo * pCallback
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
enum tagINETADDRTYPE INETADDRTYPE
const DWORD ADDR_TOFROM_MASK
struct tagINETADDR INETADDR
enum tagIXPSTATUS IXPSTATUS
_Check_return_ long __cdecl strtol(_In_z_ const char *_Str, _Out_opt_ _Deref_post_z_ char **_EndPtr, _In_ int _Radix)
HRESULT InternetTransport_InetServerFromAccount(InternetTransport *This, IImnAccount *pAccount, LPINETSERVER pInetServer) DECLSPEC_HIDDEN
HRESULT InternetTransport_DropConnection(InternetTransport *This) DECLSPEC_HIDDEN
HRESULT InternetTransport_Write(InternetTransport *This, const char *pvData, int cbSize, INETXPORT_COMPLETION_FUNCTION fnCompletion) DECLSPEC_HIDDEN
HRESULT InternetTransport_DoCommand(InternetTransport *This, LPCSTR pszCommand, INETXPORT_COMPLETION_FUNCTION fnCompletion) DECLSPEC_HIDDEN
HRESULT InternetTransport_GetServerInfo(InternetTransport *This, LPINETSERVER pInetServer) DECLSPEC_HIDDEN
HRESULT InternetTransport_GetStatus(InternetTransport *This, IXPSTATUS *pCurrentStatus) DECLSPEC_HIDDEN
HRESULT InternetTransport_ReadLine(InternetTransport *This, INETXPORT_COMPLETION_FUNCTION fnCompletion) DECLSPEC_HIDDEN
HRESULT InternetTransport_Init(InternetTransport *This) DECLSPEC_HIDDEN
HRESULT InternetTransport_HandsOffCallback(InternetTransport *This) DECLSPEC_HIDDEN
HRESULT InternetTransport_Connect(InternetTransport *This, LPINETSERVER pInetServer, boolean fAuthenticate, boolean fCommandLogging) DECLSPEC_HIDDEN
HRESULT InternetTransport_ChangeStatus(InternetTransport *This, IXPSTATUS Status) DECLSPEC_HIDDEN
#define memcpy(s1, s2, n)
#define sprintf(buf, format,...)
#define IsEqualIID(riid1, riid2)
static HRESULT WINAPI SMTPTransportCF_QueryInterface(LPCLASSFACTORY iface, REFIID riid, LPVOID *ppv)
static void SMTPTransport_CallbackReadResponseDoNothing(IInternetTransport *iface, char *pBuffer, int cbBuffer)
static HRESULT WINAPI SMTPTransport_InetServerFromAccount(ISMTPTransport2 *iface, IImnAccount *pAccount, LPINETSERVER pInetServer)
static void SMTPTransport_CallbackProcessDATAResponse(IInternetTransport *iface, char *pBuffer, int cbBuffer)
static HRESULT WINAPI SMTPTransport_DropConnection(ISMTPTransport2 *iface)
static HRESULT WINAPI SMTPTransport_CommandMAIL(ISMTPTransport2 *iface, LPSTR pszEmailFrom)
static void SMTPTransport_CallbackSendHello(IInternetTransport *iface, char *pBuffer, int cbBuffer)
static void SMTPTransport_CallbackReadDATAResponse(IInternetTransport *iface, char *pBuffer, int cbBuffer)
static ULONG WINAPI SMTPTransport_AddRef(ISMTPTransport2 *iface)
static HRESULT WINAPI SMTPTransport_CommandHELO(ISMTPTransport2 *iface)
static HRESULT WINAPI SMTPTransport_SendDataStream(ISMTPTransport2 *iface, IStream *pStream, ULONG cbSize)
static HRESULT WINAPI SMTPTransport_IsState(ISMTPTransport2 *iface, IXPISSTATE isstate)
static HRESULT WINAPI SMTPTransportCF_LockServer(LPCLASSFACTORY iface, BOOL fLock)
static HRESULT WINAPI SMTPTransport_GetStatus(ISMTPTransport2 *iface, IXPSTATUS *pCurrentStatus)
static void SMTPTransport_CallbackMessageReadToResponse(IInternetTransport *iface, char *pBuffer, int cbBuffer)
static HRESULT WINAPI SMTPTransport_GetServerInfo(ISMTPTransport2 *iface, LPINETSERVER pInetServer)
HRESULT WINAPI CreateSMTPTransport(ISMTPTransport **ppTransport)
static const ISMTPTransport2Vtbl SMTPTransport2Vtbl
static void SMTPTransport_CallbackDoNothing(IInternetTransport *iface, char *pBuffer, int cbBuffer)
static HRESULT WINAPI SMTPTransport_CommandEHLO(ISMTPTransport2 *iface)
static void SMTPTransport_CallbackProcessRCPTResponse(IInternetTransport *iface, char *pBuffer, int cbBuffer)
static void SMTPTransport_CallbackReadMAILResponse(IInternetTransport *iface, char *pBuffer, int cbBuffer)
static HRESULT WINAPI SMTPTransport_CommandDOT(ISMTPTransport2 *iface)
static HRESULT WINAPI SMTPTransport_CommandRCPT2(ISMTPTransport2 *iface, LPSTR pszEmailTo, INETADDRTYPE atDSN)
static HRESULT WINAPI SMTPTransport_QueryInterface(ISMTPTransport2 *iface, REFIID riid, void **ppv)
static HRESULT WINAPI SMTPTransport_SetWindow(ISMTPTransport2 *iface)
static void SMTPTransport_CallbackMessageSendDOT(IInternetTransport *iface, char *pBuffer, int cbBuffer)
static ULONG WINAPI SMTPTransport_Release(ISMTPTransport2 *iface)
static HRESULT WINAPI SMTPTransport_Connect(ISMTPTransport2 *iface, LPINETSERVER pInetServer, boolean fAuthenticate, boolean fCommandLogging)
static HRESULT WINAPI SMTPTransport_ResetWindow(ISMTPTransport2 *iface)
HRESULT SMTPTransportCF_Create(REFIID riid, LPVOID *ppv)
static void SMTPTransport_CallbackProcessMAILResponse(IInternetTransport *iface, char *pBuffer, int cbBuffer)
static HRESULT SMTPTransport_ParseResponse(SMTPTransport *This, char *pszResponse, SMTPRESPONSE *pResponse)
static IXPTYPE WINAPI SMTPTransport_GetIXPType(ISMTPTransport2 *iface)
static HRESULT WINAPI SMTPTransport_CommandDATA(ISMTPTransport2 *iface)
static void SMTPTransport_CallbackMessageSendDataStream(IInternetTransport *iface, char *pBuffer, int cbBuffer)
static void SMTPTransport_CallbackRecvHelloResp(IInternetTransport *iface, char *pBuffer, int cbBuffer)
static void SMTPTransport_CallbackReadRCPTResponse(IInternetTransport *iface, char *pBuffer, int cbBuffer)
static const IClassFactoryVtbl SMTPTransportCFVtbl
static void SMTPTransport_CallbackMessageReadFromResponse(IInternetTransport *iface, char *pBuffer, int cbBuffer)
static HRESULT WINAPI SMTPTransport_HandsOffCallback(ISMTPTransport2 *iface)
static HRESULT WINAPI SMTPTransport_CommandRCPT(ISMTPTransport2 *iface, LPSTR pszEmailTo)
static void SMTPTransport_CallbackProcessHelloResp(IInternetTransport *iface, char *pBuffer, int cbBuffer)
static HRESULT WINAPI SMTPTransportCF_CreateInstance(LPCLASSFACTORY iface, LPUNKNOWN pUnk, REFIID riid, LPVOID *ppv)
static void SMTPTransport_CallbackMessageReadResponse(IInternetTransport *iface, char *pBuffer, int cbBuffer)
static HRESULT WINAPI SMTPTransport_CommandRSET(ISMTPTransport2 *iface)
static HRESULT WINAPI SMTPTransport_Disconnect(ISMTPTransport2 *iface)
static void SMTPTransport_CallbackMessageReadDataResponse(IInternetTransport *iface, char *pBuffer, int cbBuffer)
static HRESULT WINAPI SMTPTransport_CommandQUIT(ISMTPTransport2 *iface)
static void SMTPTransport_CallbackMessageSendTo(IInternetTransport *iface, char *pBuffer, int cbBuffer)
static void SMTPTransport_CallbackMessageProcessResponse(IInternetTransport *iface, char *pBuffer, int cbBuffer)
static HRESULT WINAPI SMTPTransport_CommandAUTH(ISMTPTransport2 *iface, LPSTR pszAuthType)
static ULONG WINAPI SMTPTransportCF_AddRef(LPCLASSFACTORY iface)
static HRESULT WINAPI SMTPTransport_SendMessage(ISMTPTransport2 *iface, LPSMTPMESSAGE pMessage)
static ULONG WINAPI SMTPTransportCF_Release(LPCLASSFACTORY iface)
static void SMTPTransport_CallbackDisconnect(IInternetTransport *iface, char *pBuffer, int cbBuffer)
static HRESULT WINAPI SMTPTransport_SendMessage2(ISMTPTransport2 *iface, LPSMTPMESSAGE2 pMessage)
static HRESULT WINAPI SMTPTransport_InitNew(ISMTPTransport2 *iface, LPSTR pszLogFilePath, ISMTPCallback *pCallback)
static const IClassFactoryVtbl * SMTPTransportCF
SMTPMESSAGE pending_message
InternetTransport InetTransport
ULONG ulCurrentAddressIndex
#define CLASS_E_NOAGGREGATION