Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How do I use NMSMTP1->SubType=mtHtml?

Status
Not open for further replies.

PeterEvans

Programmer
Nov 12, 2005
3
GB
OK, this seems a daft question because when you look up TSubType the way to use it seems clear. I want to receive and send emails in both Plain text and HTML, how do I do it? I have a working solution for Plain text, but cannot make the HTML option work.

Using NMPOP31 I get the incoming HTML email OK. I then extract the <!DOCTYPE ... </HTML> HTML section and send that using NMSMTP1 with SubType set to mtHtml. I get back in Outlook the HTML as a Plain text every time, instead of being interpreted as HTML. Can someone tell me how to get round this please?

(I have seen the thread thread101-849231.)

Thanks in advance.
 
This is a sequel to my first posting on this problem above.

I have probed TSubType more closely and there are things I now do not understand arising.

Consider the following snippets of code:

Code:
Taken from Help for TSubType:

TSubType = (mtPlain, mtEnriched, mtSgml, mtTabSeperated, mtHtml);

which I presume to be an enum structure.


Taken from my email program:

...
//check for intended email type and set SubType accordingly
//
if(cIsHTML=='n')
  {//msg is Text
  NMSMTP1->SubType=mtPlain;  //assign text mode
  //look
  fprintf (fpPEPMMailSLog,"Info; Set plain text email.   Sub %d %d\n",mtPlain,NMSMTP1->SubType);
  }
//
if(cIsHTML=='y')
  {//msg is HTML
  NMSMTP1->SubType=mtHtml;  //assign HTML mode
  //look  
  fprintf (fpPEPMMailSLog,"Info; Set HTML email.   Sub %d %d\n",mtHtml,NMSMTP1->SubType);
  }
...

This produces as output:

when run with a plain text email to send
Info; Set plain text email. Sub 0 845836288

and

when run with an HTML email to send
Info; Set HTML text email. Sub 4 9523716


It can be checked with the SubType structure, above, that for both outputs, the first digit, 0 for the plain text case and 4 for the HTML case are correct. However, I have my doubts about the second digits. Why? I would understand NMSMTP1->SubType to be an integer typed component of the structure (NMSMTP) NMSMTP1, hence following an assignment I would expect its output value to be the same as the right-value, 0 or 4, in this case. It appears NOT to be. (However, I may have misinterpreted the code and would like to be corrected if so.)

Suppose I am right, i.e., the values assigned to NMSMTP1->SubType ARE as shown in the two cases, then the NMSMTP component would appear to have no hope of correctly responding to sending the email text with the intended browser mode attached. I suspect, in this case, that where the value assigned to NMSMTP1->SubType is not in the permitted range of [0 - 5] then a default of 0 is taken. In this case, it won't matter what you intend, you will always see Plain text in the browser on receiving the email, which is what I always find.

Could someone out there please repeat my test in C++ and possibly Delphi too?

I would welcome any feedback or comment, and a work-around to the problem, if that's at all possible.

Thanks for your patience in getting this far!

PE.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top