#include <stdio.h>
#pragma warning (disable: 4996) 
#pragma warning (disable: 4819) 
#pragma warning (disable: 4995) 
#include <tc/envelope.h>
#include <tc/folder.h>
#include <stdlib.h>
#include <ict/ict_userservice.h>

#include <tccore/aom.h>
#include <tccore/aom_prop.h>
#include "connor_erp_mes.h"
using namespace std;

extern "C" int POM_AM__set_application_bypass(logical bypass);


int WX3_send_mail(void* returnValue)
{
	char *title, *content;
	tag_t dataset, target_user, *copy_user, envelope_tag;
	int copy_user_num;
	USERARG_get_string_argument(&title);
	USERARG_get_string_argument(&content);
	USERARG_get_tag_argument(&target_user);
	USERARG_get_tag_array_argument(&copy_user_num, &copy_user);
	USERARG_get_tag_argument(&dataset);
	MAIL_create_envelope(title, content, &envelope_tag);
	MAIL_initialize_envelope2(envelope_tag, title, content);//这句存在此处，可能发不出邮件
	MAIL_add_envelope_receiver(envelope_tag, target_user);
	for (auto i = 0; i<copy_user_num; i++)
	{
		MAIL_add_envelope_cc_receiver(envelope_tag, copy_user[i]);
	}
	//AOM_set_value_tags(envelope_tag, "contents", 1, tags);
	FL_insert(envelope_tag, dataset, 1);
	MAIL_send_envelope(envelope_tag);
	return 0;
}


