Delphi 发送邮件 通过Office Outlook


网上搜到的Delphi邮件发送系统,绝大多数是使用SMTP协议来发送。

但是事实上它们已经过时了,大多数邮件服务器已经屏蔽了Delphi Indy的邮件发送,从而导致Delphi发送不成功。

事实上,让Delphi通过Outlook.Application来发送邮件,也是非常方便的,而且没有那么多的限制。

以下是我目前使用的,我把它写成了个函数,使用的时候调用一下即可。

不过,使用的前提是,你得现在在本地Outlook上配置好一个账户。

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
procedure TForm1.SendOutlookMail(const Recipient,Title,Body,Attachment:string);
    const
       olMailItem = 0;
    var
       Outlook: OleVariant;
       vMailItem: variant;
    begin
       try
          Outlook := GetActiveOleObject("Outlook.Application");
       except
          Outlook := CreateOleObject("Outlook.Application");
       end;
       vMailItem := Outlook.CreateItem(olMailItem);
       vMailItem.Recipients.Add(Recipient);
       vMailItem.Subject := Title;
       vMailItem.Body := Body;
       if Attachment <>"" then vMailItem.Attachments.Add(Attachment);
       vMailItem.Send;
       VarClear(Outlook);

 

Delphi 发送邮件 通过Office Outlook的更多相关文章

  1. 20160330001 调用及触发Office Outlook 约会

    using System;using System.Collections.Generic;using System.ComponentModel;using System.Data;using Sy ...

  2. office outlook 無法開啟 outlook 視窗

    例如[無法啟動Microsoft Office Outlook.無法開啟Outlook 視窗.] 1.啟動 Outlook 安全模式outlook.exe /safe2.清除並重新產生目前設定檔的功能 ...

  3. JavaScript API for Office Outlook Add-in - “一页纸文档“

    上一篇文章 Office Add-in Model 为 Outlook Mail Add-in 提供的 JavaScript API 介绍 ,简单地在表格中列出了所有的 Object 定义,但是个人感 ...

  4. Delphi发送邮件...

    ///首先在控件栏定位到:Indy Clients加入控件IdSMTP ///再定位到:Indy Misc加入控件IdMessage ///发送邮件函数 procedure TForm1.SendMa ...

  5. Office - Outlook

    将邮件存到本地 服务器容量有限,避免丢失和经常提示容量不足 步骤 在File->Account Settings->Account Settings下面 在Data Files标签页新建一 ...

  6. 配置Office Outlook 2013

    导航 背景——配置过程——错误(Error)——参考资料 背景 最近,折腾了一阵子邮箱客户端,包括:Foxmail.thuderbird.outlook:最后,考虑到outlook对文本的强大的支持能 ...

  7. 在Office Outlook 2013中收发QQ邮件

    选择手动配置 选择第三项 点击More Settings,在Outgoing  Server 勾选 如下 确认后,按下一步完成配置,此时会弹出对话框进行邮件发送测试.

  8. [Outlook] Outlook2013能收但无法发送邮件-0x800CCC13, 0x800CCC0B, 0x8004210B

    [20140704更新],在公司收邮件的时候,问题再次出现,错误码:0x800ccc13,按照以下方法测试成功: 1. 按照以前办法,反复重启,失败 2. 按照以下参考连接A中的步骤 a. Click ...

  9. C#调用Outlook来发送邮件

    原文:C#调用Outlook来发送邮件 写了一个简单的Windows Form程序,实现利用Outlook来发送电子邮件的功能.下面逐步讲解如何实现,再加上具体的代码. 打开VS2010, 新建一个W ...

随机推荐

  1. angular过滤器使用 自定义过滤器

    <!DOCTYPE html> <html> <head> <meta charset="utf-8"> <script sr ...

  2. PHP $_SERVER 变量

    $_SERVER 数组元素 $_SERVER 是一个包含诸如头信息(header).路径(path)和脚本位置(script locations)的数组.它是 PHP 中一个超级全局变量,我们可以在 ...

  3. C语言 Linux环境变量

    /* *@author cody *@date 2014-08-12 *@description */ /* extern char **environ //environment values #i ...

  4. SQL 查询结果为 XML

    --原始数据 SELECT  OrderNO,CreateDate,Username,Address FROM   Whir_Order_OrderInfo --1.AUTO模式 SELECT  Or ...

  5. 【Android应用开发技术:用户界面】布局管理器

    作者:郭孝星 微博:郭孝星的新浪微博 邮箱:allenwells@163.com 博客:http://blog.csdn.net/allenwells Github:https://github.co ...

  6. error: Semantic Issue: Interface type cannot be statically allocated

    转自:http://hongmin118.iteye.com/blog/1333524 error: Semantic Issue: Interface type cannot be statical ...

  7. Scala具体解释---------控制结构和函数

    条件表达式: Scala的if else语法结构和Java的一样.只是,Scala的if else表达式有值.这个值就是跟在if或者else后面的表达式的值. 比如: if(x>0) 0 els ...

  8. jQuery 语法(一)

    通过 jQuery,您可以选取(查询,query) HTML 元素,并对它们执行“操作”(actions). jQuery 语法实例 $(this).hide() 演示 jQuery hide() 函 ...

  9. ajax发送请求时为url添加参数(使用函数)

    <script> // ajax的get请求,使用函数向其url添加参数 function addURLParam(url,name,value){ url+=(url.indexOf(' ...

  10. HTML5七巧板canvas绘图

    <!DOCTYPE html> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <m ...