grbrren
June 12th, 2001, 01:49 PM
Hi,
I would greatly appreciate any help or direction with this. A client of mine wants me to develop
a small plug-in that places a button on the new message composition toolbar of common email programs. When clicked, the message’s TO: address needs to be modified slightly, then sent via the default account, as if the send button was clicked. He needs a version of this plug-in developed for Microsoft Outlook, Outlook Express, Qualcomm Eudora, Lotus Notes, and Netscape Messenger.
I am mostly a web designer and don't know where to start with this. What would be used to create something like this? C++? Where can I go for references/ examples?
Thank you so much.
Saeed
June 14th, 2001, 12:25 AM
#include <mapix.h>
#include <mapiutil.h>
#include <mapitags.h>
#include <mapi.h>
write a fun in C++ like (MFC)
//==============================================================================================
static bool Mailto(CString name, CString address,CString Subject,CString Text)
{
HRESULT hr = S_OK;
HINSTANCE MapiLib = NULL;
MapiMessage Message;
MapiRecipDesc recip;
Message.ulReserved = 0;
CTime today(CTime::GetCurrentTime());
CString x;
x.Format(_T("On %d-%d-%d at %d:%d %s"),
today.GetYear(),
today.GetMonth(),
today.GetDay(),
today.GetHour(),
today.GetMinute(),
Text);
Message.lpszSubject = (LPTSTR)((LPCTSTR)Subject); //NULL; //limit subject to less than 256 characters...
Message.lpszNoteText =(LPTSTR)((LPCTSTR) x) ;
Message.lpszMessageType = NULL; //for non-IPM messages, leave NULL
Message.lpszDateReceived = NULL; //date format is YYYY/MM/DD HH:MM (24 hour clock)
Message.lpszConversationID = NULL; //ignore this...
Message.flFlags = 0; //could set MAPI_RECEIPT_REQUESTED for read report
Message.lpOriginator = NULL; //sender info (MapiRecipDesc structure)
Message.nRecipCount = 1; //number of recipients in array below
Message.lpRecips = &recip; //array of MapiRecipDesc structures
Message.nFileCount = 0; //number of attached files
Message.lpFiles = NULL; //array of MapiFileDesc structures
memset(&recip, 0, sizeof(MapiRecipDesc)); //zero it all to defaults
recip.ulRecipClass = MAPI_TO; //regular recipient
recip.lpszName = (LPTSTR)((LPCTSTR)name);
CString email = _T("SMTP:"); //hard code address type
email += address;
recip.lpszAddress = (LPTSTR)((LPCTSTR)email);
MapiLib = ::LoadLibrary(_T("MAPI32.DLL")); //Manual access only since no .lib file
if (NULL == MapiLib)
{
AfxMessageBox(AFX_IDP_FAILED_MAPI_LOAD);
return false;
}
ULONG (PASCAL *lpfnSendMail)(ULONG, ULONG, MapiMessage*, FLAGS, ULONG);
(FARPROC&)lpfnSendMail = GetProcAddress(MapiLib, "MAPISendMail");
if (NULL == lpfnSendMail)
{
AfxMessageBox(AFX_IDP_INVALID_MAPI_DLL);
FreeLibrary(MapiLib); //decrement reference count
return false;
}
if (SUCCEEDED(hr))
hr = lpfnSendMail(0/*(ULONG)m_hWnd*/, 0, &Message, MAPI_LOGON_UI , 0); //Simple MAPI function
else
{
AfxMessageBox(_T("Message could not be sent.Low level MAPI error."));
FreeLibrary(MapiLib); //decrement reference count
return false;
}
FreeLibrary(MapiLib); //decrement reference count
return true;
}
// and call it like
Mailto("SS Admin",m_strEmail,"SS Import Malfunction","There is a problem detected with xxxxxx Import Process.\nPlease investigate\n\nThank You\nAdmin");
I will rate if your hint was helpful and expect to be rated if I was helpful ...
http://images.x10.com/traffic/bw_mid5.gif