在Salesforce中處理Email的發送

在Salesforce中可以用自帶的 Messaging 的?sendEmail?方法去處理Email的發送

請看如下一段簡單代碼:

public boolean TextFormat {get;set;}
public string EmailTo {get;set;}
public string EmailCC {get;set;}
public string EmailBCC {get;set;}
public string EmailSubject {get;set;}
public string EmailBody {get;set;}public string MoreAttachName1 {get;set;}
public blob MoreAttachBody1 {get;set;}
public string MoreAttachName2 {get;set;}
public blob MoreAttachBody2 {get;set;}
public string MoreAttachName3 {get;set;}
public blob MoreAttachBody3 {get;set;}public PageReference Send(){List<Messaging.EmailFileAttachment> attachments = new List<Messaging.EmailFileAttachment>();// Add attachmentsif(MoreAttachBody1 != null) attachments.add(CreateEmailAttachment(MoreAttachName1, MoreAttachBody1));if(MoreAttachBody2 != null) attachments.add(CreateEmailAttachment(MoreAttachName2, MoreAttachBody2));if(MoreAttachBody3 != null) attachments.add(CreateEmailAttachment(MoreAttachName3, MoreAttachBody3));Messaging.SingleEmailMessage mail = new Messaging.SingleEmailMessage();mail.setUseSignature(false);mail.setToAddresses(EmailTo.split(';',0));if(EmailCC != '') mail.setCcAddresses(EmailCC.split(';',0));if(EmailBCC != '') mail.setBccAddresses(EmailBCC.split(';',0));mail.setSubject(EmailSubject);if(TextFormat) mail.setPlainTextBody(EmailBody);else mail.setHtmlBody(EmailBody);if(attachments.size() > 0) mail.setFileAttachments(attachments); // Send the emailMessaging.sendEmail(new Messaging.SingleEmailMessage[] { mail });PageReference page = new PageReference('/'+Id);page.setRedirect(true);return page;
}private Messaging.EmailFileAttachment CreateEmailAttachment(string name, blob body) {Messaging.EmailFileAttachment emailAttach = new Messaging.EmailFileAttachment();emailAttach.setFileName(name);emailAttach.setInline(false);emailAttach.Body = body;return emailAttach;
}

?

如果想了解更多的細節,請看如下鏈接:

http://www.salesforce.com/us/developer/docs/apexcode/Content/apex_System_Messaging_instance_methods.htm?

http://www.salesforce.com/us/developer/docs/apexcode/Content/apex_Messaging_SingleEmailMessage_instance_methods.htm

?

?

?

轉載于:https://www.cnblogs.com/mingmingruyuedlut/p/3438091.html

本文來自互聯網用戶投稿,該文觀點僅代表作者本人,不代表本站立場。本站僅提供信息存儲空間服務,不擁有所有權,不承擔相關法律責任。
如若轉載,請注明出處:http://www.pswp.cn/news/392291.shtml
繁體地址,請注明出處:http://hk.pswp.cn/news/392291.shtml
英文地址,請注明出處:http://en.pswp.cn/news/392291.shtml

如若內容造成侵權/違法違規/事實不符,請聯系多彩編程網進行投訴反饋email:809451989@qq.com,一經查實,立即刪除!

相關文章

kvm vnc的使用,鼠標漂移等

1.宿主機的vnc&#xff08;virtual Network Computing&#xff09;配置 安裝rpm包 yum install tigervnc-server -y 為了防止干擾直接關閉防火墻和selinux /etc/init.d/iptables stop setenforce 0 配置vnc密碼和啟動vncserver服務 vncpasswd vncserver 2.客戶機的vnc 在qemu…

php深淺拷貝,JavaScript 中的深淺拷貝

工作中經常會遇到需要復制 JavaScript 數據的時候&#xff0c;遇到 bug 時實在令人頭疼&#xff1b;面試中也經常會被問到如何實現一個數據的深淺拷貝&#xff0c;但是你對其中的原理清晰嗎&#xff1f;一起來看一下吧&#xff01;一、為什么會有深淺拷貝想要更加透徹的理解為什…

使用Python進行地理編碼和反向地理編碼

Geocoding is the process of taking input text, such as an address or the name of a place, and returning a latitude/longitude location. To put it simply, Geocoding is converting physical address to latitude and longitude.地理編碼是獲取輸入文本(例如地址或地點…

java開發簡歷編寫_如何通過幾個簡單的步驟編寫出色的初級開發人員簡歷

java開發簡歷編寫So you’ve seen your dream junior developer role advertised, and are thinking about applying. It’s time to write that Resume! Nothing better than sitting down to a blank piece of paper and not knowing how to start, right?因此&#xff0c;您…

leetcode 628. 三個數的最大乘積(排序)

給定一個整型數組&#xff0c;在數組中找出由三個數組成的最大乘積&#xff0c;并輸出這個乘積。 示例 1: 輸入: [1,2,3] 輸出: 6 解題思路 最大的乘積可能有兩種情況 1.兩個最小負數和一個最大正數 2.三個最大正數 代碼 class Solution {public int maximumProduct(int[…

[Object-C語言隨筆之三] 類的創建和實例化以及函數的添加和調用!

上一小節的隨筆寫了常用的打印以及很基礎的數據類型的定義方式&#xff0c;今天就來一起學習下如何創建類與函數的一些隨筆&#xff1b; 首先類的創建&#xff1a;在Xcode下&#xff0c;菜單File&#xff0d;New File&#xff0c;然后出現選擇class模板&#xff0c;如下圖&…

2024-AI人工智能學習-安裝了pip install pydot但是還是報錯

2024-AI人工智能學習-安裝了pip install pydot但是還是報錯 出現這樣子的錯誤&#xff1a; /usr/local/bin/python3.11 /Users/wangyang/PycharmProjects/studyPython/tf_model.py 2023-12-24 22:59:02.238366: I tensorflow/core/platform/cpu_feature_guard.cc:182] This …

grafana 創建儀表盤_創建儀表盤前要問的三個問題

grafana 創建儀表盤可視化 (VISUALIZATIONS) It’s easier than ever to dive into dashboarding, but are you doing it right?深入儀表板比以往任何時候都容易&#xff0c;但是您這樣做正確嗎&#xff1f; Tableau, Power BI, and many other business intelligence tools …

qq群 voiceover_如何在iOS上使用VoiceOver為所有人構建應用程序

qq群 voiceoverby Jayven N由Jayven N 如何在iOS上使用VoiceOver為所有人構建應用程序 (How to build apps for everyone using VoiceOver on iOS) 輔助功能入門 (Getting started with accessibility) There’s always those topics that people don’t talk about enough. S…

IntelliJ IDEA代碼常用的快捷鍵(自查)

IntelliJ IDEA代碼常用的快捷鍵有&#xff1a; Alt回車 導入包&#xff0c;自動修正 CtrlN 查找類 CtrlShiftN 查找文件 CtrlAltL 格式化代碼 CtrlAltO 優化導入的類和包 AltInsert 生成代碼(如get,set方法,構造函數等) CtrlE或者AltShiftC 最近更改的代碼 CtrlR…

leetcode 1489. 找到最小生成樹里的關鍵邊和偽關鍵邊(并查集)

給你一個 n 個點的帶權無向連通圖&#xff0c;節點編號為 0 到 n-1 &#xff0c;同時還有一個數組 edges &#xff0c;其中 edges[i] [fromi, toi, weighti] 表示在 fromi 和 toi 節點之間有一條帶權無向邊。最小生成樹 (MST) 是給定圖中邊的一個子集&#xff0c;它連接了所有…

帶彩色字體的man pages(debian centos)

1234567891011121314151617181920212223242526272829303132333435363738我的博客已遷移到xdoujiang.com請去那邊和我交流簡介most is a paging program that displays,one windowful at a time,the contents of a file on a terminal. It pauses after each windowful and prin…

提取json對象中的數據,轉化為數組

var xx1 ["樂譜中的調號為&#xff08; &#xff09;調", "寫出a自然小調音階。", "以G為冠音&#xff0c;構寫增四、減五音程。", "調式分析。", "將下列樂譜移為C大調。", "正確組合以下樂譜。", "以下…

java 同步塊的鎖是什么,java – 同步塊 – 鎖定多個對象

我添加了另一個答案&#xff0c;因為我還沒有添加評論給其他人的帖子。>事實上&#xff0c;同步是用于代碼&#xff0c;而不是對象或數據。在同步塊中用作參數的對象引用表示鎖定。所以如果你有如下代碼&#xff1a;class Player {// Same instance shared for all players.…

大數據對社交媒體的影響_數據如何影響媒體,廣告和娛樂職業

大數據對社交媒體的影響In advance of our upcoming event — Data Science Salon: Applying AI and ML to Media, Advertising, and Entertainment, we asked our speakers, who are some of nation’s leading data scientists in the media, advertising, and entertainment…

Go-項目結構和代碼組織

簡介 做大量的輸入&#xff0c;通過對比、借鑒&#xff0c;加上自己的經驗&#xff0c;產出一個盡可能優的方案。 開源界優秀項目的結構示例 因為最新的 Go 版本已經使用 module 作為版本依賴&#xff0c;所以&#xff0c;所有項目的 vendor 我都忽略&#xff0c;建議直接使用 …

iref streams_如何利用Neo4j Streams并建立即時數據倉庫

iref streamsby Andrea Santurbano通過安德里亞桑圖爾巴諾(Andrea Santurbano) 如何利用Neo4j Streams并建立即時數據倉庫 (How to leverage Neo4j Streams and build a just-in-time data warehouse) In this article, we’ll show how to create a Just-In-Time Data Wareho…

Nodejs正則表達式函數之match、test、exec、search、split、replace使用詳解

1. Match函數使用指定的正則表達式函數對字符串驚醒查找&#xff0c;并以數組形式返回符合要求的字符串原型&#xff1a;stringObj.match(regExp)參數&#xff1a;stringObj 必選項&#xff0c;需要去進行匹配的字符串RegExp 必選項&#xff0c;指定的正則表達式返回值&#xf…

Zabbix 3.0 從入門到精通(zabbix使用詳解)

第1章 zabbix監控 1.1 為什么要監控 在需要的時刻&#xff0c;提前提醒我們服務器出問題了 當出問題之后&#xff0c;可以找到問題的根源 網站/服務器 的可用性 1.1.1 網站可用性 在軟件系統的高可靠性&#xff08;也稱為可用性&#xff0c;英文描述為HA&#xff0c;High Avail…

python 裝飾器裝飾類_5分鐘的Python裝飾器指南

python 裝飾器裝飾類重點 (Top highlight)There’s no doubt that Python decorators are one of the more advanced and tougher-to-understand programming concepts. This doesn’t mean you should avoid learning them — as you encounter them in production code soone…