<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
	<channel>
		<title><![CDATA[My Visual Database — send mail]]></title>
		<link>https://myvisualdatabase.com/forum/viewtopic.php?id=7726</link>
		<atom:link href="https://myvisualdatabase.com/forum/extern.php?action=feed&amp;tid=7726&amp;type=rss" rel="self" type="application/rss+xml" />
		<description><![CDATA[The most recent posts in send mail.]]></description>
		<lastBuildDate>Thu, 01 Dec 2022 10:03:49 +0000</lastBuildDate>
		<generator>PunBB</generator>
		<item>
			<title><![CDATA[Re: send mail]]></title>
			<link>https://myvisualdatabase.com/forum/viewtopic.php?pid=46500#p46500</link>
			<description><![CDATA[<p>Another option, but not easy to use on a system using MS Exchange is a simple</p><div class="codebox"><pre><code>SendMail(&#039;YOUR SERVER NAME&#039;,&#039;YOUR EMAIL ADDRESS&#039;,&#039;YOUR EMAIL PASSWORD&#039;,PORT # Outlook is on,&#039;RECIPIENT EMAIL ADDRESS&#039;,&#039;MESSAGE TITLE&#039;,&#039;MESSAGE TEXT&#039;);</code></pre></div><p>A variation on the code in the previous post is below. This is aimed at sending an email on a corporate Outlook server system:</p><br /><div class="codebox"><pre><code> Outlook := CreateOleObject(&#039;Outlook.Application&#039;);



    //vMailItem := Outlook.GetNamespace(&#039;MAPI&#039;);

    vMailItem.Logon;
    vMailItem := Outlook.CreateItem(olMailItem);
    vMailItem.Recipients.Add(&#039;RECIPIENT EMAIL ADDRESS HERE&#039;);
    vMailItem.Subject := &#039;What a wonderful test email&#039;;
    vMailItem.HTMLBody := sList.text; //   &#039;This is a test --&gt; how amazing&#039;;
    //vMailItem.Send;
    vMailItem.Display;
    Outlook.free;</code></pre></div>]]></description>
			<author><![CDATA[null@example.com (CDB)]]></author>
			<pubDate>Thu, 01 Dec 2022 10:03:49 +0000</pubDate>
			<guid>https://myvisualdatabase.com/forum/viewtopic.php?pid=46500#p46500</guid>
		</item>
		<item>
			<title><![CDATA[Re: send mail]]></title>
			<link>https://myvisualdatabase.com/forum/viewtopic.php?pid=46499#p46499</link>
			<description><![CDATA[<div class="quotebox"><cite>geochrist wrote:</cite><blockquote><p>Hi</p><p>The email test.zip file does not contain any code!</p></blockquote></div><br /><p>I&#039;m not sure what you mean that no code is in the zip file.</p><br /><br /><p>Below is code that works in Windows 10. I developed it on a Windows 10 PC.&nbsp; Note Outlook can be temperamental&nbsp; when using HTML, it may not always display correctly.</p><p>This takes information from a tablegrid and attempts to format it as a grid in an Outlook email. The text in red is all that is needed to actually use Outlook.&nbsp; The MAILTO&nbsp; line will work in any modern email client</p><br /><div class="codebox"><pre><code>procedure frmEmail_btnSendEmail_OnClick (Sender: TObject; var Cancel: boolean);
const
    olMAILITEM = 0;
var
    Outlook: Variant;
    vMailItem: variant;
    indx : integer;
    txt, propName: String;
    sList:TstringList;
begin
         sList:=TStringList.Create;
         sList.Add(&#039;&lt;html&gt;&#039;);
         sList.Add(&#039;&lt;head&gt;&#039;);
         sList.add(&#039;&lt;style&gt;&#039;);
         sList.Add(&#039;table, th, td {&#039;);
         sList.Add(&#039; border: 1px solid #dddddd; text-align: left; padding: 8px&#039;);
         sList.Add(&#039;}&#039;);
         sList.Add(&#039;&lt;/style&gt;&#039;);
         sList.add(&#039;&lt;/head&gt;&#039;);
         sList.Add(&#039;&lt;body&gt;&#039;);
         sList.Add(&#039;&lt;table&gt;&#039;);
         sList.Add(&#039;&lt;tr&gt;&lt;th&gt;Part Number&lt;/th&gt;&#039;+ &#039;&lt;th&gt;BSuite#&lt;/th&gt;&#039; + &#039;&lt;th&gt;Description&#039;+ &#039;&lt;/th&gt;&#039;+&#039;&lt;th&gt;Qty&#039;+&#039;&lt;/th&gt;&#039;+&#039;&lt;th&gt;For&#039;+&#039;&lt;/th&gt;&#039;+&#039;&lt;/tr&gt;&#039;);

         for indx := 0 to frmEmail.tgEmailList.RowCount-1 do
         begin
            sList.Add(&#039;&lt;tr&gt;&lt;td&gt;&#039;+frmEmail.tgEmailList.Cells[0,indx] + &#039;&lt;/td&gt;&#039; + &#039;&lt;td&gt;&#039; +frmEmail.tgEmailList.Cells[1,indx] +&#039;&lt;/td&gt;&#039;+&#039;&lt;td&gt;&#039;+frmEmail.tgEmailList.Cells[2,indx]+&#039;&lt;/td&gt;&#039;+&#039;&lt;td&gt; x &#039;+frmEmail.tgEmailList.Cells[3,indx]+&#039;&lt;/td&gt;&#039;+&#039;&lt;td&gt;&#039;+frmEmail.tgEmailList.Cells[4,indx]+&#039;&lt;/td&gt;&lt;/tr&gt;&#039;);
         end;
         sList.Add(&#039;&lt;/table&gt;&#039;);
         sList.Add(&#039;&lt;/body&gt;&#039;);
         sList.Add(&#039;&lt;/html&gt;&#039;);


        if frmEmail.cmbSupplierList.ItemIndex = -1 then
         messagebox(&#039;You have not selected an order to email. Please select a supplier&#039;, &#039;EMAILING ERROR&#039;,0)
       else
       begin
          frmEmail.tgEmailList.dbPopUPMenu.Items.Find(&#039;Copy All&#039;).click;
          txt := ClipboardGet;
         try
         [color=red]  [b]propName := &#039;https://schemas.microsoft.com/mapi/proptag/0x59020003&#039;;
           Outlook := CreateOleObject(&#039;Outlook.Application&#039;);
           vMailItem := Outlook.GetNamespace(&#039;MAPI&#039;);
           vMailItem.Logon(null,null,true,null);
           vMailItem := Outlook.CreateItem(olMailItem);
           vMailItem.Recipients.Add(frmEmail.cmbEmailAddress.Text);
           vMailItem.Subject := frmEmail.cmbSupplierList.Text;
           vMailItem.HTMLBody := sList.text;
           OutLook.SetProperty(propName, EncodingFlag);
           vMailItem.Send;
           Outlook.free;[/b][/color]
         except

           openURL(&#039;mailto:&#039;+frmEmail.cmbEmailAddress.Text+&#039;?Subject=&#039;+frmEmail.cmbSupplierList.Text+&#039; Order&#039;+&#039;&amp;Body=&#039;+sList.text);
         end;
       end;

   
end;

   </code></pre></div>]]></description>
			<author><![CDATA[null@example.com (CDB)]]></author>
			<pubDate>Thu, 01 Dec 2022 09:58:53 +0000</pubDate>
			<guid>https://myvisualdatabase.com/forum/viewtopic.php?pid=46499#p46499</guid>
		</item>
		<item>
			<title><![CDATA[Re: send mail]]></title>
			<link>https://myvisualdatabase.com/forum/viewtopic.php?pid=46497#p46497</link>
			<description><![CDATA[<p>Hi</p><p>The email test.zip file does not contain any code! Have you found a solution to send emails under windows 10? Can someone post a project that works?</p><p>Thank you<br />George</p>]]></description>
			<author><![CDATA[null@example.com (geochrist)]]></author>
			<pubDate>Wed, 30 Nov 2022 12:44:12 +0000</pubDate>
			<guid>https://myvisualdatabase.com/forum/viewtopic.php?pid=46497#p46497</guid>
		</item>
		<item>
			<title><![CDATA[Re: send mail]]></title>
			<link>https://myvisualdatabase.com/forum/viewtopic.php?pid=42197#p42197</link>
			<description><![CDATA[<p>Sample project attached.</p><p>Change all the &#039;fake email addresses &#039; with real ones in the script.&nbsp; Of course in a real environment you may use a textbox.text for the email address or a combobox.</p>]]></description>
			<author><![CDATA[null@example.com (CDB)]]></author>
			<pubDate>Sat, 11 Sep 2021 21:07:25 +0000</pubDate>
			<guid>https://myvisualdatabase.com/forum/viewtopic.php?pid=42197#p42197</guid>
		</item>
		<item>
			<title><![CDATA[Re: send mail]]></title>
			<link>https://myvisualdatabase.com/forum/viewtopic.php?pid=42158#p42158</link>
			<description><![CDATA[<p>hello CDB . Can You post Sample project.</p>]]></description>
			<author><![CDATA[null@example.com (blackpearl8534)]]></author>
			<pubDate>Thu, 09 Sep 2021 12:57:52 +0000</pubDate>
			<guid>https://myvisualdatabase.com/forum/viewtopic.php?pid=42158#p42158</guid>
		</item>
		<item>
			<title><![CDATA[Re: send mail]]></title>
			<link>https://myvisualdatabase.com/forum/viewtopic.php?pid=42141#p42141</link>
			<description><![CDATA[<p>Thanks both of you ..</p><p>I&#039;ll try both procedures</p>]]></description>
			<author><![CDATA[null@example.com (blackpearl8534)]]></author>
			<pubDate>Wed, 08 Sep 2021 07:16:15 +0000</pubDate>
			<guid>https://myvisualdatabase.com/forum/viewtopic.php?pid=42141#p42141</guid>
		</item>
		<item>
			<title><![CDATA[Re: send mail]]></title>
			<link>https://myvisualdatabase.com/forum/viewtopic.php?pid=42110#p42110</link>
			<description><![CDATA[<p>An example:</p><p>The code below tries to open Outlook and fill it with HTML content, if that fails a simple text based email is sent.</p><br /><div class="codebox"><pre><code>procedure frmEmail_btnSendEmail_OnClick (Sender: TObject; var Cancel: boolean);
const
    olMAILITEM = 0;
var
    Outlook: Variant;
    vMailItem: variant;
    indx : integer;
    txt, propName: String;
    sList:TstringList;
begin
         sList:=TStringList.Create;
         sList.Add(&#039;&lt;html&gt;&#039;);
         sList.Add(&#039;&lt;head&gt;&#039;);
         sList.add(&#039;&lt;style&gt;&#039;);
         sList.Add(&#039;table, th, td {&#039;);
         sList.Add(&#039; border: 1px solid #dddddd; text-align: left; padding: 8px&#039;);
         sList.Add(&#039;}&#039;);
         sList.Add(&#039;&lt;/style&gt;&#039;);
         sList.add(&#039;&lt;/head&gt;&#039;);
         sList.Add(&#039;&lt;body&gt;&#039;);
         sList.Add(&#039;&lt;table&gt;&#039;);
         sList.Add(&#039;&lt;tr&gt;&lt;th&gt;Part Number&lt;/th&gt;&#039;+ &#039;&lt;th&gt;BSuite#&lt;/th&gt;&#039; + &#039;&lt;th&gt;Description&#039;+ &#039;&lt;/th&gt;&#039;+&#039;&lt;th&gt;Qty&#039;+&#039;&lt;/th&gt;&#039;+&#039;&lt;th&gt;For&#039;+&#039;&lt;/th&gt;&#039;+&#039;&lt;/tr&gt;&#039;);

         for indx := 0 to frmEmail.tgEmailList.RowCount-1 do
         begin
            sList.Add(&#039;&lt;tr&gt;&lt;td&gt;&#039;+frmEmail.tgEmailList.Cells[0,indx] + &#039;&lt;/td&gt;&#039; + &#039;&lt;td&gt;&#039; +frmEmail.tgEmailList.Cells[1,indx] +&#039;&lt;/td&gt;&#039;+&#039;&lt;td&gt;&#039;+frmEmail.tgEmailList.Cells[2,indx]+&#039;&lt;/td&gt;&#039;+&#039;&lt;td&gt; x &#039;+frmEmail.tgEmailList.Cells[3,indx]+&#039;&lt;/td&gt;&#039;+&#039;&lt;td&gt;&#039;+frmEmail.tgEmailList.Cells[4,indx]+&#039;&lt;/td&gt;&lt;/tr&gt;&#039;);
         end;
         sList.Add(&#039;&lt;/table&gt;&#039;);
         sList.Add(&#039;&lt;/body&gt;&#039;);
         sList.Add(&#039;&lt;/html&gt;&#039;);


        if frmEmail.cmbSupplierList.ItemIndex = -1 then
         messagebox(&#039;You have not selected an order to email. Please select a supplier&#039;, &#039;EMAILING ERROR&#039;,0)
       else
       begin
          frmEmail.tgEmailList.dbPopUPMenu.Items.Find(&#039;Copy All&#039;).click;
          txt := ClipboardGet;
         try
           propName := &#039;https://schemas.microsoft.com/mapi/proptag/0x59020003&#039;;
           Outlook := CreateOleObject(&#039;Outlook.Application&#039;);
           vMailItem := Outlook.GetNamespace(&#039;MAPI&#039;);
           vMailItem.Logon(null,null,true,null);
           vMailItem := Outlook.CreateItem(olMailItem);
           vMailItem.Recipients.Add(frmEmail.cmbEmailAddress.Text);
           vMailItem.Subject := frmEmail.cmbSupplierList.Text;
           vMailItem.HTMLBody := sList.text;
           OutLook.SetProperty(propName, EncodingFlag);
           vMailItem.Send;
           Outlook.free;
         except

           openURL(&#039;mailto:&#039;+frmEmail.cmbEmailAddress.Text+&#039;?Subject=&#039;+frmEmail.cmbSupplierList.Text+&#039; Order&#039;+&#039;&amp;Body=&#039;+sList.text);
         end;
       end;

    frmEmail.tgEmailList.SelectRange(0,frmEmail.tgEmailList.RowCount -1,TRUE);
    for indx := 0 to frmEmail.tgEmailList.RowCount -1 do
    begin

      SQLExecute(&#039;UPDATE orders SET orderEmailed = 1 WHERE orders.id = &quot;&#039;+ intToStr(frmEmail.tgEmailList.dbIndexToID(indx))+&#039;&quot;&#039;);

    end;
    frmEmail.cmbSupplierList.ItemIndex := -1;
    sList.free;
end;</code></pre></div>]]></description>
			<author><![CDATA[null@example.com (CDB)]]></author>
			<pubDate>Tue, 07 Sep 2021 09:44:20 +0000</pubDate>
			<guid>https://myvisualdatabase.com/forum/viewtopic.php?pid=42110#p42110</guid>
		</item>
		<item>
			<title><![CDATA[Re: send mail]]></title>
			<link>https://myvisualdatabase.com/forum/viewtopic.php?pid=42092#p42092</link>
			<description><![CDATA[<p><a href="http://myvisualdatabase.com/forum/viewtopic.php?id=3917">http://myvisualdatabase.com/forum/viewtopic.php?id=3917</a></p>]]></description>
			<author><![CDATA[null@example.com (sibprogsistem)]]></author>
			<pubDate>Mon, 06 Sep 2021 21:57:16 +0000</pubDate>
			<guid>https://myvisualdatabase.com/forum/viewtopic.php?pid=42092#p42092</guid>
		</item>
		<item>
			<title><![CDATA[send mail]]></title>
			<link>https://myvisualdatabase.com/forum/viewtopic.php?pid=42073#p42073</link>
			<description><![CDATA[<p>hello friends..<br />i need send mail working sample...<br />please upload...</p>]]></description>
			<author><![CDATA[null@example.com (blackpearl8534)]]></author>
			<pubDate>Mon, 06 Sep 2021 11:29:48 +0000</pubDate>
			<guid>https://myvisualdatabase.com/forum/viewtopic.php?pid=42073#p42073</guid>
		</item>
	</channel>
</rss>
