Example #1
0
        public static string QYSend(QYMsgParams qymsgParams)
        {
            string url = " https://qyapi.weixin.qq.com/cgi-bin/message/send?access_token=" + AccessTokenService.GetQYAccessToken();

            string msg = JsonConvert.SerializeObject(qymsgParams);

            return(AppService.WebRequestPost(url, msg));
        }
Example #2
0
        public void Process(WorkflowPipelineArgs args)
        {
            Assert.ArgumentNotNull(args, "args");
            ProcessorItem processorItem = args.ProcessorItem;

            if (processorItem != null)
            {
                Item   innerItem = processorItem.InnerItem;
                string fullPath  = innerItem.Paths.FullPath;
                string sendFrom  = GetText(innerItem, "SendFrom", args);
                string toUser    = GetText(innerItem, "ToUser", args);
                //string host = GetText(innerItem, "mail server", args);
                string messageTitle = GetText(innerItem, "MessageTitle", args);
                string messageBody  = GetText(innerItem, "MessageBody", args);
                Error.Assert(toUser.Length > 0, "The 'To' field is not specified in the mail action item: " + fullPath);
                Error.Assert(sendFrom.Length > 0, "The 'From' field is not specified in the mail action item: " + fullPath);
                Error.Assert(messageTitle.Length > 0,
                             "The 'Subject' field is not specified in the mail action item: " + fullPath);
                //Error.Assert(host.Length > 0,
                //             "The 'Mail server' field is not specified in the mail action item: " + fullPath);
                //var message = new MailMessage(from, to);
                //message.Subject = subject;
                //message.Body = body;
                //new SmtpClient(host).Send(message);
                QYMsgParams qymsgParams = new QYMsgParams();
                qymsgParams.touser  = toUser;
                qymsgParams.msgtype = "text";
                qymsgParams.agentid = AgentID;
                qymsgParams.safe    = "0";

                MsgContent msgContent = new MsgContent();
                msgContent.content = messageBody;

                qymsgParams.text = msgContent;
                string r1 = MsgService.QYSend(qymsgParams);
            }
        }