all groups > iis smtp nntp > november 2005 >
You're in the

iis smtp nntp

group:

Protocol Event Sink


Re: Protocol Event Sink Junk Mail
11/24/2005 12:00:00 AM
iis smtp nntp: Now I got the sample to work... not easy for at none C++ guy :-)

I can now close the smtp connection with this code, but how do I get til
senders ip address?

/*
** ISmtpInCommandSink
*/
STDMETHODIMP CSink::OnSmtpInCommand(
IUnknown *pServer,
IUnknown *pSession,
IMailMsgProperties *pMsg,
ISmtpInCommandContext *pContext)
{

HRESULT hr = S_OK;
if(pContext == NULL)
return E_POINTER;

char* pszResponse = NULL;
long lResponseLength = strlen(g_szResponseText);
pszResponse = (char*) CoTaskMemAlloc(g_dwResponseSize);
strcpy(pszResponse,g_szResponseText);
pszResponse[g_dwResponseSize-1] = '\0';
hr = pContext->SetResponse(pszResponse, g_dwResponseSize);
if(FAILED(hr))
return hr;

hr = pContext->SetSmtpStatusCode(550);

if(FAILED(hr))
return hr;

hr = pContext->SetCommandStatus(EXPE_DROP_SESSION);

if(FAILED(hr))
return hr;

// Success.
// Notify the dispatcher that we have
// consummed the event.
// No other sinks will run, and
// the connection will be dropped.

return EXPE_S_CONSUMED;
}


Protocol Event Sink Junk Mail
11/24/2005 9:30:10 PM
I am not a C++ programmer, but still I need to create a 'White List
function' on my SMTP Server at protocol level, because I need to terminate
the SMTP connection...

I tried to build the ShieldsUp Protocol Event Sink with ATL
http://msdn.microsoft.com/library/en-us/smtpevt/html/e6fa1c76-5e3a-4307-b465-3dc8d82c93d4.asp

I can compile but, I can't register the event

Can anyone help me?

I can't attatch the project, but if you can help me, I will send the Zip
file

Re: Protocol Event Sink Egbert Nierop (MVP for IIS)
11/25/2005 12:00:00 AM

[quoted text, click to view]

I got this working as well. It uses Active Directory as a whitelist
container.
The difficulties exist at the documentation level. MS did not document this
too well, since it would be against there own Exchange product :)

Re: Protocol Event Sink Junk Mail
11/28/2005 1:37:18 PM
Is it possible to get you code?



"Egbert Nierop (MVP for IIS)" <egbert_nierop@nospam.invalid> wrote in
message news:O3Og9Oc8FHA.2192@TK2MSFTNGP14.phx.gbl...
[quoted text, click to view]

Re: Protocol Event Sink Johan Karl Larsen
12/1/2005 8:21:14 PM

[quoted text, click to view]

You could read a property from IMailMsgProperties:

CHAR szBuf[100];

if (pMsg) // This interface pointer will only be initialized after "MAIL
FROM: <user@domain>"
{
hr = pMsg->GetStringA(IMMPID_MP_CONNECTION_IP_ADDRESS, sizeof(szBuf),
szBuf);
......
}


where IMMPID_MP_CONNECTION_IP_ADDRESS is defined in mailmsgprops.h (Platform
SDK).

--
Johan

AddThis Social Bookmark Button