<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
	<channel>
		<title><![CDATA[Серый форум &mdash; AHK: Отправка сообщений с вложениями через CDO]]></title>
		<link>https://forum.script-coding.com/viewtopic.php?id=17059</link>
		<atom:link href="https://forum.script-coding.com/extern.php?action=feed&amp;tid=17059&amp;type=rss" rel="self" type="application/rss+xml" />
		<description><![CDATA[Недавние сообщения в теме «AHK: Отправка сообщений с вложениями через CDO».]]></description>
		<lastBuildDate>Mon, 18 Apr 2022 09:50:28 +0000</lastBuildDate>
		<generator>PunBB</generator>
		<item>
			<title><![CDATA[Re: AHK: Отправка сообщений с вложениями через CDO]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=152800#p152800</link>
			<description><![CDATA[<p>По-моему, лучше utf-8.</p>]]></description>
			<author><![CDATA[null@example.com (teadrinker)]]></author>
			<pubDate>Mon, 18 Apr 2022 09:50:28 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=152800#p152800</guid>
		</item>
		<item>
			<title><![CDATA[Re: AHK: Отправка сообщений с вложениями через CDO]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=152798#p152798</link>
			<description><![CDATA[<p>А не подскажите, как передать русский текст?<br />Нашел решение, нужно после &quot;objMessage := ComObjCreate(&quot;CDO.Message&quot;)&quot; добавить:<br /></p><div class="codebox"><pre><code>objMessage.BodyPart.Charset := &quot;windows-1251&quot;</code></pre></div>]]></description>
			<author><![CDATA[null@example.com (Phoenixxx_Czar)]]></author>
			<pubDate>Mon, 18 Apr 2022 04:57:04 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=152798#p152798</guid>
		</item>
		<item>
			<title><![CDATA[Re: AHK: Отправка сообщений с вложениями через CDO]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=152790#p152790</link>
			<description><![CDATA[<p>Во всяком случае не с помощью объекта CDO.Message.</p>]]></description>
			<author><![CDATA[null@example.com (teadrinker)]]></author>
			<pubDate>Thu, 14 Apr 2022 16:25:32 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=152790#p152790</guid>
		</item>
		<item>
			<title><![CDATA[Re: AHK: Отправка сообщений с вложениями через CDO]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=152787#p152787</link>
			<description><![CDATA[<p><strong>teadrinker</strong><br />Добрый день, а возможно ли сохранение письма в &quot;отправленных&quot;?</p>]]></description>
			<author><![CDATA[null@example.com (inseption86)]]></author>
			<pubDate>Thu, 14 Apr 2022 16:03:31 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=152787#p152787</guid>
		</item>
		<item>
			<title><![CDATA[Re: AHK: Отправка сообщений с вложениями через CDO]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=152768#p152768</link>
			<description><![CDATA[<p><strong>teadrinker</strong>, благодарю, вы помогли не только мне, но и людям из 2025, которые тоже будут задаваться таким вопроса хе-хе. Спасибо вам большое!</p>]]></description>
			<author><![CDATA[null@example.com (yakmuve)]]></author>
			<pubDate>Wed, 13 Apr 2022 09:20:22 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=152768#p152768</guid>
		</item>
		<item>
			<title><![CDATA[Re: AHK: Отправка сообщений с вложениями через CDO]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=152767#p152767</link>
			<description><![CDATA[<p>То же самое, вместо звёздочек своё имя пользователя.</p>]]></description>
			<author><![CDATA[null@example.com (teadrinker)]]></author>
			<pubDate>Wed, 13 Apr 2022 08:35:07 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=152767#p152767</guid>
		</item>
		<item>
			<title><![CDATA[Re: AHK: Отправка сообщений с вложениями через CDO]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=152765#p152765</link>
			<description><![CDATA[<p><strong>teadrinker</strong>, хм, а что вы подставляли вместо </p><div class="codebox"><pre><code>From: &quot;&quot;&quot;AHKUser&quot;&quot; &lt;******@gmail.com&gt;&quot;</code></pre></div><p> просто может я тупой новичок что-то не туда поставил...</p>]]></description>
			<author><![CDATA[null@example.com (yakmuve)]]></author>
			<pubDate>Wed, 13 Apr 2022 08:24:10 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=152765#p152765</guid>
		</item>
		<item>
			<title><![CDATA[Re: AHK: Отправка сообщений с вложениями через CDO]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=152763#p152763</link>
			<description><![CDATA[<p>Не знаю, у меня так работает:<br /></p><div class="codebox"><pre><code>objMessage := ComObjCreate(&quot;CDO.Message&quot;)

Keys := { Subject: &quot;Example CDO Message&quot;
        , From: &quot;&quot;&quot;AHKUser&quot;&quot; &lt;******@gmail.com&gt;&quot;
        , To: &quot;******@mail.ru&quot;
        , Subject: &quot;hi&quot;
        , HTMLBody: &quot;&lt;p style=&quot;&quot;color: #004488; font-size: 15pt; font-family: Calibri,Verdana&quot;&quot;&gt;&quot;  ; или TextBody 
                  . &quot;Первая строка сообщения&lt;br&gt;Вторая строка сообщения&lt;/p&gt;&quot; }

for key, value in Keys
   objMessage[key] := value

objMessage.AddAttachment(&quot;D:\Downloads\Иконки\AutoHotKey Logo (Medium).ico&quot;)

namespace := &quot;http://schemas.microsoft.com/cdo/configuration/&quot;
Fields := { sendusing: 2
          , smtpserver: &quot;smtp.gmail.com&quot;
          , smtpauthenticate: 1
          , sendusername: &quot;******@gmail.com&quot;
          , sendpassword: &quot;****************&quot; ; пароль приложения https://support.google.com/accounts/answer/185833?hl=ru&amp;ref_topic=7189145
          , smtpusessl: 1
          , smtpconnectiontimeout: 60
          , smtpserverport: 465 }

for field, value in Fields
   objMessage.Configuration.Fields.Item(namespace . field) := value
   
objMessage.Configuration.Fields.Update
objMessage.Send</code></pre></div><p>Проверял на Windows 7 и 10.</p>]]></description>
			<author><![CDATA[null@example.com (teadrinker)]]></author>
			<pubDate>Wed, 13 Apr 2022 08:20:37 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=152763#p152763</guid>
		</item>
		<item>
			<title><![CDATA[Re: AHK: Отправка сообщений с вложениями через CDO]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=152758#p152758</link>
			<description><![CDATA[<p><strong>teadrinker</strong> Хм, сделал пароль приложения (Windows, ToMail (написал название ahk без указания расширения) и на выходе получил 16-ти значный пароль) и вставил его в код на место пароля, </p><div class="codebox"><pre><code>fields.sendusername := &quot;123456789@gmail.com&quot;
fields.sendpassword := &quot;****************&quot;</code></pre></div><p>однако ошибка осталась. Может быть я как-то некорректно указал имя пользователя или пароль?</p>]]></description>
			<author><![CDATA[null@example.com (yakmuve)]]></author>
			<pubDate>Wed, 13 Apr 2022 05:50:48 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=152758#p152758</guid>
		</item>
		<item>
			<title><![CDATA[Re: AHK: Отправка сообщений с вложениями через CDO]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=152757#p152757</link>
			<description><![CDATA[<p>Возможно, нужно ввести <a href="https://support.google.com/accounts/answer/185833?hl=ru&amp;ref_topic=7189145">пароль приложения</a> (а не пароль аккаунта). Порт 465.</p>]]></description>
			<author><![CDATA[null@example.com (teadrinker)]]></author>
			<pubDate>Tue, 12 Apr 2022 23:13:10 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=152757#p152757</guid>
		</item>
		<item>
			<title><![CDATA[AHK: Отправка сообщений с вложениями через CDO]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=152756#p152756</link>
			<description><![CDATA[<p>Здравствуйте, понадобилась автоматизация данного процесса. Изучив просторы интернета нашёл такой код (аж из 2014):<br /></p><div class="codebox"><pre><code>pmsg 			:= ComObjCreate(&quot;CDO.Message&quot;)
pmsg.From 		:= &quot;&quot;&quot;AHKUser&quot;&quot; &lt;...@gmail.com&gt;&quot;
pmsg.To 		:= &quot;anybody@somewhere.com&quot;
pmsg.BCC 		:= &quot;&quot;   ; Blind Carbon Copy, Invisable for all, same syntax as CC
pmsg.CC 		:= &quot;Somebody@somewhere.com, Other-somebody@somewhere.com&quot;
pmsg.Subject 	:= &quot;Message_Subject&quot;

;You can use either Text or HTML body like
pmsg.TextBody 	:= &quot;Message_Body&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;


sAttach   		:= &quot;Path_Of_Attachment&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;...@gmail.com&quot;
fields.sendpassword := &quot;your_password_here&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)
pmsg.Send()</code></pre></div><p>Все данные у себя я заполнил/изменил. Номер порта выставил 25. После &quot;таймаута&quot; выходит ошибка 0x80040213.<br />Error: 0x80040213<br />Source: CDO.Message.1<br />Description: Транспорту не удалось подключиться к серверу.<br />HelpFile: (null)<br />HelpContext: 0<br />Specifically: Send</p><p>---&gt; pmsg.Send()</p><p>Прошу вас о помощи, либо задачка сложная, либо я тупой (скорее второе).</p>]]></description>
			<author><![CDATA[null@example.com (yakmuve)]]></author>
			<pubDate>Tue, 12 Apr 2022 20:26:42 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=152756#p152756</guid>
		</item>
	</channel>
</rss>
