|
Hi,
ive got an application which needs to send a HTML email with some embedded images in it.
Ive so far got the ability to send a plain text file with the .html file as an attachment, but thats no good for what i need.
Does anyone have any help or advice for getting HTML messages to work?
Here is my current code:
<br />
MapiRecipDesc DefaultRecipient =<br />
{<br />
0,
MAPI_TO,
"Mark Ingram",
"SMTP:me@me.com",
0,
NULL
};<br />
<br />
MapiFileDesc AttachedFiles = <br />
{<br />
0,
0,
0,
szTempFileName,
ModGetFileName(pMod),
NULL
};<br />
<br />
MapiMessage MailMessage =<br />
{<br />
0,
"Subject",
" \nYour files are attached and ready to send with this message.\n",
NULL,
NULL,
NULL,
0,
NULL,
0,
NULL,
sizeof(AttachedFiles) / sizeof(MapiFileDesc),
&AttachedFiles
};<br />
<br />
...<br />
<br />
(*lpfnMAPILogon)(0, NULL, NULL, MAPI_NEW_SESSION, 0, &lhSession);<br />
<br />
ulReturn = (*lpfnMAPISendMail)(lhSession, 0, &MailMessage, MAPI_DIALOG, 0);<br />
<br />
(*lpfnMAPILogoff)(lhSession, 0, 0, 0);<br />
Cheers
Skute
|
|
|
|
|
I seem to remember the body of the message needing to have <!DOCTYPE HTML PUBLIC"-//IETF//DTD HTML//EN"> at the beginning.
"The pointy end goes in the other man." - Antonio Banderas (Zorro, 1998)
|
|
|
|
|
No that hasnt helped unfortunately
I used the code:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"><HTML><HEAD><TITLE></TITLE><META http-equiv=Content-Type content="text/html; charset=iso-8859-1"><BODY><P><FONT size=2>test</FONT></P></BODY></HTML>
As the message body, but it just displays that exactly as it is (if you look at the format options the format is set to plain text and not HTML).
Cheers
Skute
|
|
|
|
|
Skute wrote:
As the message body, but it just displays that exactly as it is (if you look at the format options the format is set to plain text and not HTML).
Are you sure that the e-mail client is not doing this? Some clients can only receive text messages, and any HTML that is received gets converted to text or outright removed.
Also, have you read the MSDN article Q268440?
"The pointy end goes in the other man." - Antonio Banderas (Zorro, 1998)
|
|
|
|
|
I use PJ Naughter's excellent CSMTPConnection[^] class for HTML email.
Sonork 100.11743 Chicken Little
"You're obviously a superstar." - Christian Graus about me - 12 Feb '03
Within you lies the power for good - Use it!
|
|
|
|
|
unfortunately we cant use any MFC. But thanks for the link.
Its gotta be a c/c++ implementation.
Cheers
Skute
|
|
|
|
|
I fail to understand the logic behind "can't use any MFC". Why make yourself jump through all sorts of hoops to reinvent the wheel.
As for the CSMTPConnection class, all it uses are CString , CArray , and CStringArray . It should not be to difficult to go through the code and replace them with the string and array classes that fit your requirements.
Sonork 100.11743 Chicken Little
"You're obviously a superstar." - Christian Graus about me - 12 Feb '03
Within you lies the power for good - Use it!
|
|
|
|
|
PJ Arends wrote:
I fail to understand the logic behind "can't use any MFC". Why make yourself jump through all sorts of hoops to reinvent the wheel.
Because the project at work was started about 5 years ago by the MD of the project in standard C, therefore must use standard C.
And anyway, even if i didnt, i still prefer standard API calls, MFC is so bloated, yeah you can get small apps up and running really fast but when the project starts to grow it gets extremely difficult to stay in control of it all.
(Anyway, we should leave this as it isnt an MFC vs API thread :p)
PJ Arends wrote:
As for the CSMTPConnection class, all it uses are CString, CArray, and CStringArray. It should not be to difficult to go through the code and replace them with the string and array classes that fit your requirements.
Thanks, ill go through it and try to convert it,
Regards
Skute
|
|
|
|
|
Hmm, it appears that class actually sends the email itself via sockets etc. I was after a MAPI based solution that would open the default mail client's "New Message" window with the pre-written email. It would then be upto the mail client to send the message.
Cheers anyway tho.
Skute
|
|
|
|
|
Hello
I've got a file with reserved words and i want to load them to the heap memory. The problem is that i want to be able to work with the char **reservwords after loading it in the function loadreswords, i mean i want to see it in main.
The following code works for c++, as i pass it by reference (char **& reservwords in function header). But i need an ANSI C way of solving the problem.
Somebody said that i could use a char *reservwords[], but when i declare it the compiler says that the size is unknown, as i don't put anything between the [] as i want specify it's size after counting the number of words, and in c you must declare variables at the beginning of funtions.. thanks for helping!
<br />
<br />
void main (void)<br />
{<br />
char **reservwords;<br />
loadreswords (reservwords);<br />
}<br />
<br />
void loadreswords (char **& reservwords)<br />
{<br />
<br />
palres = (char**) malloc ((sizeof(char*))*(*count_of_words));<br />
<br />
<br />
palres[j] = (char*) malloc (strlen(word)+1);<br />
}<br />
<br />
|
|
|
|
|
I dont quite understand your thinking behind your structure there, but surely the *& at the end cancel each other out. Therefore youre just expecting a char*??
Anyway, try using a double pointer in the function:
(Note also, main should be declared as int main in c/c++)
<br />
int main()<br />
{<br />
char* pointer;<br />
dofunc(&pointer);<br />
<br />
free(pointer);<br />
return 0;<br />
}<br />
<br />
void dofunc(char** dblpointer)<br />
{<br />
*dblpointer = (char *)malloc(strlen(text) + 1);<br />
}<br />
Hope that helps ya
Skute
|
|
|
|
|
what i am expecting from the file is a list of words. Part of the file:
auto
asm
break
case
char
const
continue
default
.
(continues)
.
void
volatile
while
(eof)
with :
<br />
void dofunc(char** dblpointer)<br />
{<br />
*dblpointer = (char *)malloc(strlen(text) + 1);<br />
}<br />
i think you are loading one word and i need to load a list of words.
|
|
|
|
|
Do you really have to use C? This seems like an obvious application for something like std::set<std::string> to me.
Anyway.
void LoadReservedWords ( char *** pppc )
{
int i ;
int count = CountReservedWords () ;
char ** ppc ;
ppc = (char **) malloc (( count + 1 ) * sizeof ( char * )) ;
for ( i = 0; i < count; ++i )
{
ppc [ i ] = ( char * ) malloc ( sizeof ( char ) * ReservedWordSize ( i ));
strcpy ( ppc [ i ], ReservedWord ( i )) ;
}
ppc [ i ] = (char *) malloc ( sizeof ( char )) ;
*ppc [ i ] = '\0' ;
*pppc = ppc ;
}
void FreeReservedWords ( char ** ppc )
{
char ** ppc2 = ppc ;
while ( **ppc2 )
{
free ( *ppc2 ) ;
++ppc2 ;
}
free ( *ppc2 ) ;
free ( ppc ) ;
}
int main(int argc, char * argv[])
{
char ** ppc ;
int n ;
LoadReservedWords ( &ppc ) ;
for ( n = 0; *ppc [ n ]; ++n )
{
printf ( "%s\n", ppc [ n ]) ;
}
FreeReservedWords ( ppc ) ;
return 0 ;
}
I've obviously glossed the counting and accessing of your reserved words. Space is made for an empty string on the end of the array to use as a sentinel.
Paul
|
|
|
|
|
|
I placed a CListCtrl on my dialog form from the toolbox. WHen I go to use it in code, the hwnd ofthe associated variable m_list (I used class wizard) is 0x00. SO the code
int i = m_listInvisible.GetStringWidth(mainPath);
crashes in the debug version, but works fine in the release version!!!
Why is it zero? (Because I have a button too, and its hwnd isnt zero). Also why doesnt it crash in release?
Thanks,
ns
|
|
|
|
|
Where in your dialog code are you calling your variable?
You should also bear in mind that your control variable (if created using class wizard), will not be created until the base function, ::OnInitDialog(), has been called. If you attempt to access it before this, then it will crash!
<edit>This, may not explain why it runs in release mode though
I Dream of Absolute Zero
|
|
|
|
|
You're so right. I was calling it before the dlg->Create().
|
|
|
|
|
Hello all !
I'm using MFC in a SDI application and I want a toolbar with a single Slider control on it (just the slider, nothing else). I found some articles that describes how to add some controls on the toolbar but this doesn't work if I have just the slider...
Any idea ?
Thanks
|
|
|
|
|
What is the funktion to set the Data Source of a MS ADO DATAGRID Controll Object. A DB Grid will be set by Objekt.SetDataSet() but it did´t work for MSDG.
|
|
|
|
|
If you take, say, an Edit control or a Static control, and make it multi-line, and stuff a bunch of text into it, Windows somehow knows how to break that text up into words, and splits it nicely. It even takes the language of the machine into account - Chinese text will wrap differently than English text.
Is there a way to programmatically take advantage of this? For instance, if I have a string, and want to know where the breaks should be, taking into account locale, is there any kind of API or anything to get the proper places to break?
Thanks.
Sometimes I feel like I'm a USB printer in a parallel universe.
|
|
|
|
|
Create a hidden edit control, add your text to it, and then read from the control.
"The pointy end goes in the other man." - Antonio Banderas (Zorro, 1998)
|
|
|
|
|
David,
I don't think that will work, since word breaking is an artifact of painting the control (using the DT_WORDBREAK flag in DrawText() ). Hyphenation and stemming libraries are available (for various languages) but aren't cheap.
/ravi
My new year's resolution: 2048 x 1536
Home | Articles | Freeware | Music
ravib@ravib.com
|
|
|
|
|
Ravi Bhavnani wrote:
I don't think that will work...
Actually it does work. Try it for a full appreciation.
"The pointy end goes in the other man." - Antonio Banderas (Zorro, 1998)
|
|
|
|
|
How to change CFontDialog to allow color picker instead dropdown list of
system colors?
Putic A.
|
|
|
|
|
Who could explain to me how getline is working? I checked already a tutorial about it, but I didn't understand well.
THX
|
|
|
|