8,834
社区成员
发帖
与我相关
我的任务
分享
void MD_InitMessageInfo(
MD_MessageInfo* MessageInfo // pointer to MD_MessageInfo struct
)
The MD_InitMessageInfo structure initializes an MD_MessageInfo structure in
preparation for sending an email message using MD_SpoolMessage.
Parameters
MessageInfo - pointer to an MD_MessageInfo structure. This members of this
structure are cleared and the priority member is set to
MD_PRECEDENCE_NORMAL.
Remarks
You should call this function immediately after declaring an MD_MessageInfo
structure.
Example
MD_MessageInfo MessageInfo;
MD_InitMessageInfo(&MessageInfo);
MDUser.InitMessageInfo MessageInfo
This method initializes the MessageInfo object in preparation for sending an email message
using MDUser.SpoolMessage.
Parameters
MessageInfo - MDMessageInfo ojbect. The priority attribute is set to
MD_PRECEDENCE_NORMAL.
Remarks
You should call this method immediately after creating an instance of the MDMessageInfo object.
MDUser mdu = new MDUser();
MDMessageInfo MessageInfo = new MDMessageInfo();
MessageInfo.To = "test1@ceshi.com";
MessageInfo.From = "test2@ceshi.com";
MessageInfo.Subject = "邮件主题";
MessageInfo.MessageBody = "邮件正文内容";
mdu.InitMessageInfo(MessageInfo);
MDUser mdu = new MDUser();
MDMessageInfo MessageInfo = new MDMessageInfo();
MessageInfo.To = "test1@ceshi.com";
MessageInfo.From = "test2@ceshi.com";
MessageInfo.Subject = "邮件主题";
MessageInfo.MessageBody = "邮件正文内容";
mdu.InitMessageInfo(MessageInfo);
这段代码要怎么写才正确。。#define MDUSERDLL_MAXMSGTO_LEN 128
#define MDUSERDLL_MAXMSGFROM_LEN 128
#define MDUSERDLL_MAXMSGSUBJECT_LEN 128
#define MDUSERDLL_MAXCONTENTTYPE_LEN 128
#define MDUSERDLL_MAXCHARSET_LEN 30
#define MDUSERDLL_MAXMSGBODY_LEN 5001
struct MD_MessageInfo
{
char To[MDUSERDLL_MAXMSGTO_LEN+1];
char From[MDUSERDLL_MAXMSGFROM_LEN+1];
char Subject[MDUSERDLL_MAXMSGSUBJECT_LEN+1];
char ContentType[MDUSERDLL_MAXCONTENTTYPE_LEN+1];
char CharSet[MDUSERDLL_MAXCHARSET_LEN+1];
char MessageBody[MDUSERDLL_MAXMSGBODY_LEN+1];
char BodyFilePath[MAX_PATH+1];
char AttachmentFilePath[MAX_PATH+1];
bool RemoveAttachment;
int Priority;
};
--------------------
MDMessageInfo Object
--------------------
MDUSERDLL_MAXMSGTO_LEN 128
MDUSERDLL_MAXMSGFROM_LEN 128
MDUSERDLL_MAXMSGSUBJECT_LEN 128
MDUSERDLL_MAXMSGBODY_LEN 2048
Properties:
To - String value, max length is MDUSERDLL_MAXMSGTO_LEN
From - String value, max length is MDUSERDLL_MAXMSGFROM_LEN
Subject - String value, max length is MDUSERDLL_MAXMSGSUBJECT_LEN
MessageBody - String value, max length is MDUSERDLL_MAXMSGBODY_LEN
BodyFilePath - String value, max length is 255
AttachmentFilePath - String value, max length is 255
RemoveAttachment - Boolean value
Priority - Long value
Field Descriptions
To - this field contains the name of the recipient of the email message.
It can contain any value which MDaemon allows within the TO header of a
RAW format message (see MDaemon manual for details)
From - this field contains the name of the sender of the email message.
It can contain any value which MDaemon allows within the FROM header of a
RAW format message (see MDaemon manual for details)
Subject - this field contains the subject of the email message.
MessageBody - this field contains the text of the message body.
BodyFilePath - this field contains the path to a text file that should be
used as the message body. After calling MD_SpoolMessage you should remove
this file.
AttachmentFilePath - this field contains the path to a single file on disk
which should be encoded and attached to the message.
RemoveAttachment - if TRUE the file specified in AttachmentFilePath will be
removed from disk once the message has been converted for sending by
MDaemon.
Priority - this field specifies the relative importance of this message.
ContentType - this field specifies the content type, ie. 'text/html'
CharSet - this field specifies the character set, ie. 'iso-8859-1'
Remarks
The MessageBody field has a maximum length of MDUSERDLL_MAXMSGBODY_LEN
chars. If this is not enough space the text should be placed in a separate
disk file and the BodyFilePath field should be used. Note that both can
be used in the same structure. So, you can specify up to
MDUSERDLL_MAXMSGBODY_LEN chars in the MessageBody field and place the rest
in a text file for use with the BodyFilePath field.
Only a single file can be specified in the AttachmentFilePath field.
The RemoveAttachment field does not cause the attached file to be removed
immediately. The file is removed by MDaemon once the RAW message is
converted and fully prepared for delivery. This is done by MDaemon when
the RAW queue is processed.
The Priority field can contain any one of the following values:
MD_PRECEDENCE_URGENT // an extremely important message
MD_PRECEDENCE_HIGH // a message that is more important than normal
MD_PRECEDENCE_NORMAL // this is the default for normal mail
MD_PRECEDENCE_LOW // some system or robot generated mail
MD_PRECEDENCE_BULK // default mailing list mail
MD_PRECEDENCE_RETRY // messages in the retry queue
Methods:
None
MDUser mdu = new MDUser();
MDMessageInfo MessageInfo = new MDMessageInfo();
MessageInfo.To = "test1@ceshi.com";
MessageInfo.From = "test2@ceshi.com";
MessageInfo.Subject = "邮件主题";
MessageInfo.MessageBody = "邮件正文内容";
// The priority attribute is set to MD_PRECEDENCE_NORMAL.
MessageInfo.Priority = MD_PRECEDENCE_NORMAL; // 自己在接口文档中找这个常量的定义
mdu.InitMessageInfo(ref MessageInfo); // 标记 ref