OSDN Git Service

Send email to multi person success and add CC and TO list
[tortoisegit/TortoiseGitJp.git] / src / TortoiseProc / Patch.cpp
index 7bebda9..f9a06f8 100644 (file)
@@ -31,46 +31,28 @@ void CPatch::ConvertToArray(CString &to,CStringArray &Array)
 \r
 int CPatch::Send(CString &pathfile,CString &TO,CString &CC,bool bAttachment)\r
 {\r
-       CSmtp mail;\r
-       \r
-       if(mail.GetLastError() != CSMTP_NO_ERROR )\r
-       {\r
-               return -1;\r
-       }\r
-       \r
+       CHwSMTP mail;\r
        if(this->Parser(pathfile)       )\r
                return -1;\r
 \r
-       int at=TO.Find(_T('@'));\r
-       int start =0;\r
-       TO = TO.Tokenize(_T(";"),start);\r
-\r
-       CString server=TO.Mid(at+1);\r
-\r
-       PDNS_RECORD pDnsRecord; \r
-\r
-       DnsQuery(server, DNS_TYPE_MX,DNS_QUERY_BYPASS_CACHE,\r
-                                           NULL,                   //Contains DNS server IP address.\r
-                        &pDnsRecord,                //Resource record that contains the response.\r
-                        NULL); \r
-\r
-       CString name,address;\r
-       GetNameAddress(this->m_Author,name,address);\r
-\r
-\r
-       CStringArray attchments,CCArray;\r
+       CStringArray attachments,CCArray;\r
        if(bAttachment)\r
        {\r
-               attchments.Add(pathfile);\r
+               attachments.Add(pathfile);\r
        }\r
        \r
-       ConvertToArray(CC,CCArray);\r
+       //ConvertToArray(CC,CCArray);\r
 \r
-       SendEmail(FALSE,pDnsRecord->Data.MX.pNameExchange,\r
-               NULL,NULL,FALSE,address,TO,this->m_Author,TO,this->m_Subject,m_strBody,0,&attchments,&CCArray);\r
-                                       \r
-       DnsRecordListFree(pDnsRecord,DnsFreeRecordList);\r
+       CString sender;\r
+       sender.Format(_T("%s <%s> "),g_Git.GetUserName(),g_Git.GetUserEmail());\r
 \r
+       if(mail.SendSpeedEmail(this->m_Author,TO,this->m_Subject,this->m_strBody,NULL,&attachments,CC,25,sender))\r
+               return 0;\r
+       else\r
+       {\r
+               this->m_LastError=mail.GetLastErrorText();\r
+               return -1;\r
+       }\r
 #if 0\r
        CRegString server(REG_SMTP_SERVER);\r
        CRegDWORD  port(REG_SMTP_PORT,25);\r
@@ -142,7 +124,7 @@ int CPatch::Parser(CString &pathfile)
 \r
        g_Git.StringAppend(&m_strBody,&m_Body[0],CP_ACP);\r
        \r
-\r
+       return 0;\r
 }\r
 \r
 void CPatch::GetNameAddress(CString &in, CString &name,CString &address)\r
@@ -159,7 +141,7 @@ void CPatch::GetNameAddress(CString &in, CString &name,CString &address)
        else\r
                address=in;\r
 }\r
-\r
+#if 0\r
 void CPatch::AddRecipient(CSmtp &mail, CString &tolist, bool isCC)\r
 {\r
        int pos=0;\r
@@ -191,4 +173,5 @@ void CPatch::AddRecipient(CSmtp &mail, CString &tolist, bool isCC)
                                mail.AddRecipient(CUnicodeUtils::GetUTF8(one));\r
                }\r
        }\r
-}
\ No newline at end of file
+}\r
+#endif
\ No newline at end of file