<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
	<channel>
		<title><![CDATA[Серый форум &mdash; AHK: Отправка логов]]></title>
		<link>https://forum.script-coding.com/viewtopic.php?id=16848</link>
		<atom:link href="https://forum.script-coding.com/extern.php?action=feed&amp;tid=16848&amp;type=rss" rel="self" type="application/rss+xml" />
		<description><![CDATA[Недавние сообщения в теме «AHK: Отправка логов».]]></description>
		<lastBuildDate>Sat, 01 Jan 2022 04:17:12 +0000</lastBuildDate>
		<generator>PunBB</generator>
		<item>
			<title><![CDATA[Re: AHK: Отправка логов]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=151465#p151465</link>
			<description><![CDATA[<div class="quotebox"><cite>yakmuve пишет:</cite><blockquote><p>Здравствуйте, как можно сделать, чтоб программа отправляла из EditBox сообщение на почту.</p></blockquote></div><div class="codebox"><pre><code>pmsg 			:= ComObjCreate(&quot;CDO.Message&quot;)
pmsg.From 		:= &quot;&quot;&quot;AHKUser&quot;&quot; &lt;ahk.com&gt;&quot;
pmsg.To 		:= &quot;ahk.com&quot;
pmsg.BCC 		:= &quot;&quot;   ; Blind Carbon Copy, Invisable for all, same syntax as CC
;pmsg.CC 		:= &quot;ahk, Other-ahk&quot;
;pmsg.CC 		:= &quot;Somebody@somewhere.com, Other-somebody@somewhere.com&quot;
pmsg.Subject 	:= &quot;Name.&quot;

;You can use either Text or HTML body like
pmsg.TextBody 	:= &quot;Name&quot;
;OR
;pmsg.HtmlBody := &quot;&lt;html&gt;&lt;head&gt;&lt;title&gt;Hello&lt;/title&gt;&lt;/head&gt;&lt;body&gt;&lt;h2&gt;Hello&lt;/h2&gt;&lt;p&gt;Testing!&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;&quot;
fields.sendusername := &quot;lolin@gmail.com&quot;
fields.sendpassword := &quot;passwod&quot;



sAttach   		:= &quot;C:\Users\Home\Desktop\test.jpg&quot; ; can add multiple attachments, the delimiter is |

fields := Object()
fields.smtpserver   := &quot;smtp.gmail.com&quot; ; specify your SMTP server
fields.smtpserverport     := 465 ; 25
fields.smtpusessl      := True ; False
fields.sendusing     := 2   ; cdoSendUsingPort
fields.smtpauthenticate     := 1   ; cdoBasic
fields.sendusername := &quot;Somebody@somewhere.com&quot;
fields.sendpassword := &quot;password&quot;
fields.smtpconnectiontimeout := 60
schema := &quot;http://schemas.microsoft.com/cdo/configuration/&quot;
pfld :=   pmsg.Configuration.Fields

For field,value in fields
	pfld.Item(schema . field) := value
pfld.Update()

Loop, Parse, sAttach, |, %A_Space%%A_Tab%
  pmsg.AddAttachment(A_LoopField)
</code></pre></div><p>В настрайках аккаунта нужно разрешить доступ для ненадежных приложений. https://myaccount.google.com/lesssecureapps.&nbsp; Эта опция недоступна в аккаунтах с двухэтапной аутентификацией. Для gmail.com.</p><div class="codebox"><pre><code>pmsg.HtmlBodyPart.Charset := &quot;utf-8&quot;</code></pre></div><p> Если в сообщении кириллица не правильно отображается.</p>]]></description>
			<author><![CDATA[null@example.com (EV)]]></author>
			<pubDate>Sat, 01 Jan 2022 04:17:12 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=151465#p151465</guid>
		</item>
		<item>
			<title><![CDATA[Re: AHK: Отправка логов]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=151462#p151462</link>
			<description><![CDATA[<p><strong>teadrinker</strong>, да все верно. Можно любой хостинг с php.</p>]]></description>
			<author><![CDATA[null@example.com (andrey.a.polyakov.b2c)]]></author>
			<pubDate>Fri, 31 Dec 2021 21:56:06 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=151462#p151462</guid>
		</item>
		<item>
			<title><![CDATA[Re: AHK: Отправка логов]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=151401#p151401</link>
			<description><![CDATA[<p><strong>andrey.a.polyakov.b2c</strong>, правильно я понимаю, что решение предполагает наличие своего сайта либо локального сервера?</p>]]></description>
			<author><![CDATA[null@example.com (teadrinker)]]></author>
			<pubDate>Sat, 25 Dec 2021 19:54:39 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=151401#p151401</guid>
		</item>
		<item>
			<title><![CDATA[Re: AHK: Отправка логов]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=151400#p151400</link>
			<description><![CDATA[<p><strong>yakmuve</strong>, проще написать скрипт на php и уже к нему обращаясь отправлять почту, например:<br /></p><div class="codebox"><pre><code>
&lt;?php
$to = $_GET[&#039;mail&#039;];
$headers = array(
    &#039;From&#039; =&gt; &#039;Мой_Софт&lt;soft@my.ru&gt;&#039;,
    &#039;X-Mailer&#039; =&gt; &#039;PHP/&#039; . phpversion()
);
$subject = $_GET[&#039;t&#039;];
$message = $_GET[&#039;m&#039;];

mail($to,$subject,$message,$headers);
?&gt;
</code></pre></div><p>Ну и в Ahk отправляем запрос например на F2:<br /></p><div class="codebox"><pre><code>
global WinHttpRequestOption_EnableRedirects := 6
global WinHttpRequestOption_MaxAutomaticRedirects := 14
global WinHttpRequestOption_EnableHttpsToHttpRedirects := 12
global oHttpRequest := ComObjCreate(&quot;WinHttp.WinHttpRequest.5.1&quot;)
oHttpRequest.Option(WinHttpRequestOption_EnableRedirects) := -1
oHttpRequest.Option(WinHttpRequestOption_EnableHttpsToHttpRedirects) := -1
oHttpRequest.Option(WinHttpRequestOption_MaxAutomaticRedirects) := 20
global HttpObj := ComObjCreate(&quot;WinHttp.WinHttpRequest.5.1&quot;)
global oHttpRequest := ComObjCreate(&quot;WinHttp.WinHttpRequest.5.1&quot;)

F2::
    SendMail(&quot;Тестовая тема&quot;,&quot;Тестовое сообщение&quot;,&quot;mmm@yandex.ru&quot;)
Return

SendMail(subject,message,mail ) {
    try
    {
        oHtmlDoc := documentFromURL(&quot;http://сайт/mail.php?t=&quot; . subject . &quot;&amp;m=&quot; . message . &quot;&amp;mail=&quot; . mail)
        return,&quot;Письмо отправлено&quot;
    }
    catch e {
        return,&quot;Ошибка сервера &quot; . e.message
    }
}

GetHTML(ByRef sHTMLCode, ByRef sBaseURL) {
    oDoc := ComObjCreate(&quot;htmlfile&quot;)
    oDoc.open()
    oDoc.write(&quot;&lt;base href=&quot;&quot;&quot; . sBaseURL . &quot;&quot;&quot;&gt;&quot;)
    oDoc.close()
    oDoc.body.innerHTML := sHTMLCode
return oDoc
}
documentFromURL(ByRef sURL) {
    oHttpRequest.open(&quot;GET&quot;, sURL, false)
    oHttpRequest.SetRequestHeader(&quot;User-Agent&quot;, &quot;Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; WOW64; Trident/5.0)&quot;)
    oHttpRequest.SetRequestHeader(&quot;Referer&quot;, sURL)
    oHttpRequest.SetRequestHeader(&quot;Content-Type&quot;, &quot;text/html&quot;)
    oHttpRequest.send()
return GetHTML(oHttpRequest.responseText, sURL)
}
</code></pre></div>]]></description>
			<author><![CDATA[null@example.com (andrey.a.polyakov.b2c)]]></author>
			<pubDate>Sat, 25 Dec 2021 13:00:46 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=151400#p151400</guid>
		</item>
		<item>
			<title><![CDATA[Re: AHK: Отправка логов]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=151394#p151394</link>
			<description><![CDATA[<div class="quotebox"><cite>ypppu пишет:</cite><blockquote><p>По-моему не умеет AutoHotkey напрямую работать с почтой.</p></blockquote></div><p>Если чуток подзапариться, то умеет. <img src="//forum.script-coding.com/img/smilies/wink.png" width="15" height="15" /><br /><a href="http://forum.script-coding.com/viewtopic.php?id=16339">http://forum.script-coding.com/viewtopic.php?id=16339</a></p>]]></description>
			<author><![CDATA[null@example.com (Malcev)]]></author>
			<pubDate>Fri, 24 Dec 2021 21:34:45 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=151394#p151394</guid>
		</item>
		<item>
			<title><![CDATA[Re: AHK: Отправка логов]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=151393#p151393</link>
			<description><![CDATA[<p><strong>teadrinker</strong>, спасибо за ориентир, буду искать документацию касательно данных функций.</p>]]></description>
			<author><![CDATA[null@example.com (yakmuve)]]></author>
			<pubDate>Fri, 24 Dec 2021 21:13:02 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=151393#p151393</guid>
		</item>
		<item>
			<title><![CDATA[Re: AHK: Отправка логов]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=151388#p151388</link>
			<description><![CDATA[<p>AHK умет работать с COM-объектами, например, с CDO.Message.</p>]]></description>
			<author><![CDATA[null@example.com (teadrinker)]]></author>
			<pubDate>Fri, 24 Dec 2021 19:45:45 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=151388#p151388</guid>
		</item>
		<item>
			<title><![CDATA[Re: AHK: Отправка логов]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=151386#p151386</link>
			<description><![CDATA[<p>По-моему не умеет AutoHotkey напрямую работать с почтой. Ищите какие-нибудь программы-посредники, поддерживающие автоматизацию. На форуме <a href="https://autohotkey.com">https://autohotkey.com</a> много чего есть, наверное там уже поднимался такой вопрос.</p>]]></description>
			<author><![CDATA[null@example.com (ypppu)]]></author>
			<pubDate>Fri, 24 Dec 2021 19:16:50 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=151386#p151386</guid>
		</item>
		<item>
			<title><![CDATA[AHK: Отправка логов]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=151382#p151382</link>
			<description><![CDATA[<p>Здравствуйте, как можно сделать, чтоб программа отправляла из EditBox сообщение на почту.</p>]]></description>
			<author><![CDATA[null@example.com (yakmuve)]]></author>
			<pubDate>Fri, 24 Dec 2021 18:38:39 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=151382#p151382</guid>
		</item>
	</channel>
</rss>
