1. OUTLOOK怎麼發HTML代碼的郵件
提供一個思路,首先你可以做一個能通過url正常訪問的html網頁,注意html中的地址一定要加上帶域名的絕對地址,然後把這個html的源碼放到outlook中,進行修改後發送就可以了
2. outlook vba發郵件問題
仔細看了一下,原來的代碼的確有些問題,這個是我現在用的,我一次只能發不超過15封郵件,否則郵件網關(單位自有郵件伺服器)會阻止我。延遲發送是我加的,沒有測試。
我下面的代碼是在如下情況下使用(很有必要說清楚)。
就我自用來說。
首先,我有一個excel文件,其中存放的是的待發送人員的姓名以及郵件地址。
其次,我會將網路斷開,使用word的郵件功能,並使用上述excel中的郵件地址,合並,並批量生成郵件。
之後,因為網路斷開,本來要通過outlook發送的郵件,都會因為發送失敗出現在發件箱中。出於方便操作和手動控制發送節奏的目的,將發件箱中所有發送失敗的郵件拷貝到草稿箱。
最後,重新連接網路,使用上述代碼手動一次發個10封左右的郵件,我是發一次歇一會。發送郵件通過vba添加附件。(你所要求的延遲,是我臨時加的,沒有經過測試)如果加了延遲,你可以修改vba中,一次復制到發件箱郵件的個數,控制時間間隔。(也可以一次復制完畢,我出於測試的目的,第一次通常會用程序從草稿箱移動2個郵件發送,然後檢查看有無錯誤,以免錯誤過大難以控制)
希望對你有幫助,附現在用的代碼。
Option Explicit
'將草稿箱中的郵件發送出去
Const strAttachmentPath = "" '附件路徑E:\辦公\科研處\國家基金要點提示\2014自然基金模板及簡明指南摘要.rar
Const intMailCount = 10 '單次發送郵件數
Sub subSendEmail()
'On Error Resume Next
Dim fld_OutBox AsOutlook.MAPIFolder
Dim objItems As Outlook.Items
Dim myItem As Object
Dim myItems() As Object
Dim iIndex As Integer '延遲技術器
Dim intervalMinute As Integer '延遲分鍾數
Dim objMail As Outlook.MailItem
iIndex = 1
Dim n As Integer
If MsgBox("附件:" &strAttachmentPath & vbCrLf & "單次發送郵件數:" & intMailCount & vbCrLf & "以上信息正確與否?", vbOKCancel) <> vbOK Then
Exit Sub
End If
'獲得發件箱
Set fld_OutBox = Application.GetNamespace("MAPI").GetDefaultFolder(olFolderOutbox)
Set objItems = fld_OutBox.Items
If fld_OutBox.Items.Count = 0 Then
'如果發件箱郵件數為0從草稿箱中移動郵件
'從草稿箱中移動若干郵件到發件箱
funMoveMailToOutBox intMailCount
End If
'如果發件箱存在對象,對其中的郵件執行發送
If objItems.Count > 0 Then
For Each objMail In objItems
If (objMail.Class = 43) Then
'發送郵件
If (strAttachmentPath <>"") Then
'存在附件路徑,添加附件
objMail.Attachments.AddTrim(strAttachmentPath), olByValue, 1
End If
'延遲發送
'iIndex = iIndex + 1
'objMail.DeferredDeliveryTime =DateAdd("n", iIndex * intervalMinute, Now)
objMail.Send
End If
Next
End If
End Sub
Function funMoveMailToOutBox(ByVal numEmailAs Integer) As Boolean
'移動numEmail指定的郵件數從draft到outBox
'On Error Resume Next
Dim fld_OutBox AsOutlook.MAPIFolder
Dim fld_Drafts AsOutlook.MAPIFolder
Dim objItemsDrafts AsOutlook.Items
Dim objMail As Outlook.MailItem
Dim n As Integer
n= 0
'獲得發件箱對象
Set fld_OutBox =Application.GetNamespace("MAPI").GetDefaultFolder(olFolderOutbox)
'獲得草稿箱對象
Set fld_Drafts =Application.GetNamespace("MAPI").GetDefaultFolder(olFolderDrafts)
Set objItemsDrafts = fld_Drafts.Items
'按照numEmail指定的數值移動郵件
While (objItemsDrafts.Count > 0) And (n < numEmail)
'如果草稿箱不為空
Set fld_Drafts =Application.GetNamespace("MAPI").GetDefaultFolder(olFolderDrafts)
Set objItemsDrafts = fld_Drafts.Items
Set objMail = objItemsDrafts.GetFirst()
If (objMail.Class = 43) Then
objMail.Move fld_OutBox
Else
Exit Function
End If
n = n + 1
Wend
End Function
3. 如何將表單提交到指定的郵箱中(不是OUTLOOK).望給源碼.
<form action="mailto:[email protected]" encType="text/plain" method=post>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td><table width="100%" border="0" cellpadding="0" cellspacing="1" bgcolor="#CCCCCC">
<tr bgcolor="#ffffff">
<td height="20">戶 籍</td>
<td height="20"><input type="text" name="vcha_hukouaddress" value="" style="width:150px" maxlength="500"></td>
<td height="20">手機號碼</td>
<td height="20"><input type="text" name="vcha_movetel" value="" style="width:100px" maxlength="250"></td>
<td height="20">宅 電</td>
<td height="20"><input type="text" name="vcha_tel" value="" style="width:100px" maxlength="50"></td>
</tr>
<tr bgcolor="#ffffff">
<td height="20">現住地址</td>
<td height="20"><input type="text" name="vcha_zhuadd" value="" style="width:250px" maxlength="500"></td>
<td height="20">E_Mail</td>
<td height="20"><input type="text" name="vcha_email" value="" style="width:150px" maxlength="250"></td>
<td height="20">上傳照片</td>
<td height="20"><input type="text" name="upfilepath" maxlength="39" style="width:100px" value="">
<input type="button" name="mybutton" value="選擇" onClick="fileupload()"></td>
</tr>
</table></td>
</tr>
<tr>
<td></td>
</tr>
<tr>
<td> </td>
</tr>
<tr>
<td><table width="100%" border="0" cellpadding="0" cellspacing="1" bgcolor="#CCCCCC">
<tr bgcolor="#ffffff">
<td align="center"><input type="submit" onClick="SendMail()" value="提交">
<input type="button" value="關閉" onClick="window.close();">
</td>
</tr>
</table></td>
</tr>
</table>
</form>
4. outlook 2007編輯html郵件內容時怎麼不能看源代碼
不會~~
5. 有沒有能使用Excel調用OUTLOOK或者Foxmail發郵件的工具,源代碼也行,也就是VBA的。
其實Excel文件菜單里有選項可以直接把文檔發送Email,不過調用的是Windows默認內嵌的OutLookExpress程序。
6. mfc如何在原有代碼中加入Offic風格的界面
實際上,Ribbon界面(Office 2007風格的界面)的開發早在2008年就隨著Visual C++ Feature Pack被引入到Visual Studio 2008中。在即將到來的Visual Studio 2010中,Ribbon界面的開發更是得到了原生的支持,使得Ribbon界面的開發更加簡便高效。
首先,我們啟動Visual Studio 2010,創建一個基於MFC的應用程序,項目模板我們選擇「MFC Application」
在接下來的「MFC應用程序向導」中,我們就可以對項目的可視化風格進行選擇和配置。Visual Studio 2010支持MFC風格、標準的Windows風格,Visual Studio 2005風格和Office 2007風格。而這里的Office 2007風格,就是我們要創建的Ribbon界面。
在接下來的向導頁中,我們可以選擇命令欄(工具欄。菜單欄)的樣式,這里我們當然選擇「Use a ribbon」了。當然,為了跟舊有的系統保持兼容,Visual Studio 2010也支持傳統的命令式界面,如果你的用戶比較保守,想繼續使用傳統的菜單式界面,我們可以選擇「Use a menu bar and toolbar」
為了支持豐富的Office 2007界面風格,MFC默認情況下為MFC文檔應用程序添加了類似Outlook風格的導航面板(Navigation pane)和標題條(Caption bar)。這兩者並不是我們關注的重點,為了更好的展示Ribbon界面,我們這里就去掉這兩個多餘的面板。
到這里,針對新項目的設置就完成了,點擊「Finish」按鈕關閉應用程序向導,Visual Studio 2010就會按照我們的設置創建相應的MFC應用程序解決方案。編譯運行這個解決方案,我們就得到了第一個具有Ribbon界面的應用程序。
7. 如何用c++獲取outlook里的郵件
// dbx_EnsureFolders: first builds up a FolderSorting tree. Then calls
// the above function to it into the flat global vector.
//
void dbx_EnsureFolders(const string name,const string ver)
{ string testn=name, testv=ver;
if (testn=="") testn="_"; if (testv=="") testv="_";
if (dbx_DoneFoldersName==testn && dbx_DoneFoldersVer==testv) return;
dbx_DoneFoldersName=testn; dbx_DoneFoldersVer=testv;
dbx_Folders.clear();
if (dbx_DoneStores=="") dbx_EnsureStores(name);
//
// Now let's find the path for this name/ver
string path="";
for (vector<TDbxStore>::iterator i=dbx_Stores.begin(); i!=dbx_Stores.end(); i++)
{ if (name=="" && ver=="") {path=i->path; break;}
else if (name==i->name && ver==i->ver) {path=i->path; break;}
}
if (path=="") return;
string ffn = path+"\\Folders.dbx";
if (!FileExists(ffn)) return;
// Folders.dbx is an index of the folders in this profile.
// It is a flat list. Each entry has:
// id, parent-id, fn, name, regstring, subindex, value, id0b
// The id/parent-id determine the structure of the tree
// name is the folder name, and fn is the dbx filename (as a sub of path)
// For top-level ones, we look at regstring to determine the index:
// "LocalStore" is 1, some others also have numbers, some are empty (in which case we use index in the file)
// For sub-level ones, some have subindex set, some are empty (in which case we use index in the file)
// If value is 1, or if id0b is 0x2F0000, then this might be an offlineable folder.
vector<TDbxFolderSorting*> folders;
map<unsigned int,TDbxFolderSorting*> i2f;
//
// I'm using my specialised memory-mapped class here.
// Arne's code was written to use an istream instead, so you'll
// have to either change this to an istream, or change Arne's code.
imemfile inm(ffn.c_str());
if (!inm.okay()) return;
DbxFileHeader fileHeader(inm);
const int4 treeNumber=2; // This third tree stores pointers to all folder informations
int4 address = fileHeader.GetValue(fhTreeRootNodePtr+treeNumber);
int4 entries = fileHeader.GetValue(fhEntries +treeNumber);
if(address && entries)
{ DbxTree tree(inm,address,entries); // Read in the tree with all pointers
for(int4 filepos=0; filepos<entries; ++filepos)
{ int1 *ptr; int4 length;
address = tree.GetValue(filepos); // Get the address of the folder info
DbxFolderInfo folderInfo(inm,address); // Read in the folder info
unsigned int index = folderInfo.GetValue(0);
unsigned int pindex = folderInfo.GetValue(1);
string fn; ptr=folderInfo.GetValue(3,&length); if (ptr!=0 && length>0) fn=string((char*)ptr,length-1);
string name; ptr=folderInfo.GetValue(2,&length); if (ptr!=0 && length>0) name=string((char*)ptr,length-1);
string reg; ptr=folderInfo.GetValue(5,&length); if (ptr!=0 && length>0) reg=string((char*)ptr,length-1);
unsigned int pos = folderInfo.GetValue(9);
unsigned int value = folderInfo.GetValue(10);
unsigned int id0b = folderInfo.GetValue(11);
unsigned int num_to_download = folderInfo.GetValue(18);
//
bool isexplicitpos=false;
if (strncmp(reg.c_str(),"LocalStore",10)==0) reg="1";
if (reg!="" && pindex==0)
{ bool isnum=true; for (unsigned int i=0; i<reg.length(); i++) {if (reg[i]<'0' || reg[i]>'9') isnum=false;}
if (isnum) sscanf(reg.c_str(),"%lu",&pos);
}
if (pos!=0) isexplicitpos=true; else pos=filepos;
TDbxFolderSorting *parent=0;
if (pindex!=0)
{ map<unsigned int,TDbxFolderSorting*>::const_iterator i = i2f.find(pindex);
if (i!=i2f.end()) parent=i->second;
}
bool isnews = (value==0);
//
if (!isnews)
{ TDbxFolderSorting *f = new TDbxFolderSorting;
f->index = index;
f->isexplicitpos = isexplicitpos;
f->position = pos;
f->info.name = name;
f->parent = parent;
if (parent==0 || parent->parent==0) f->info.path="";
else if (parent->info.path=="") f->info.path=parent->info.name;
else f->info.path=parent->info.path+"\\"+parent->info.name;
if (parent==0) f->info.account="";
else if (parent->parent==0) f->info.account=parent->info.name;
else f->info.account=parent->info.account;
string sf="";
if (f->info.account!="") sf += f->info.account+"\\";
if (f->info.path!="") sf += f->info.path+"\\";
sf += f->info.name;
f->info.full = sf;
f->info.fn = fn;
f->info.fpath = path;
if (parent==0) f->info.depth=0; else f->info.depth=parent->info.depth+1;
if (parent==0) f->info.type=dftStructure;
else if (!f->isexplicitpos) f->info.type=dftMail;
else if (pos==1) f->info.type=dftInbox;
else if (pos==2) f->info.type=dftOutbox;
else if (pos==3) f->info.type=dftSent;
else if (pos==4) f->info.type=dftDeleted;
else if (pos==5) f->info.type=dftDrafts;
else f->info.type=dftMail;
f->info.might_contain_offlines = (value==0 || value==1 || id0b==0x2F || num_to_download>0);
// That 'num to download' isn't reliable.
//
if (parent==0) folders.push_back(f);
else parent->c.push_back(f);
i2f.insert(pair<unsigned int,TDbxFolderSorting*>(index,f));
}
}
}
inm.close();
// Now sort them and save copies into the main list ane delete them
RecEnsureFolders(folders,true);
}
imemfile::imemfile(const char *fn)
{ buf=0; isokay=false; pos=0; hf=0; hmap=0; size=0; DWORD high;
if (fn!=0) hf = CreateFile(fn,GENERIC_READ,FILE_SHARE_READ,NULL,OPEN_EXISTING,0,NULL);
if (hf==INVALID_HANDLE_VALUE) isokay=false;
else size=GetFileSize(hf,&high);
if (high!=0 || size==0) {CloseHandle(hf);hf=0; isokay=false;}
else hmap=CreateFileMapping(hf,NULL,PAGE_READONLY,0,0,NULL);
if (hmap==NULL) {CloseHandle(hf); hf=0; isokay=false;}
else buf=(const char*)MapViewOfFile(hmap,FILE_MAP_READ,0,0,0);
if (buf==0) {CloseHandle(hmap); hmap=0; CloseHandle(hf); hf=0; isokay=false;}
else isokay=true;
}
imemfile::~imemfile()
{ close();
}
void imemfile::seekg(unsigned int apos)
{ if (buf==0 || apos>size) isokay=false; else pos=apos;
}
void imemfile::read(char *dst,unsigned int rsize)
{ if (buf==0 || pos+rsize>size) isokay=false;
else {memcpy(dst,buf+pos,rsize); pos+=rsize;}
}
bool imemfile::okay()
{ return isokay;
}
void imemfile::close()
{ if (buf!=0) UnmapViewOfFile(buf); buf=0;
if (hmap!=0) CloseHandle(hmap); hmap=0;
if (hf!=0) CloseHandle(hf); hf=0;
size=0; pos=0; isokay=false;
}
// IsValidDbxFile: to tell whether a given file is a valid DBX file
//
bool IsValidDbxFile(const string fn,bool wantfolders)
{ HANDLE hf = CreateFile(fn.c_str(),GENERIC_READ,FILE_SHARE_READ,NULL,OPEN_EXISTING,0,NULL);
if (hf==INVALID_HANDLE_VALUE) return false;
DWORD high; DWORD size=GetFileSize(hf,&high);
CloseHandle(hf);
if (high!=0 || size<FileHeaderSize) return false;
bool okay=false;
imemfile inm(fn.c_str());
try
{ DbxFileHeader fileHeader(inm);
int4 length = fileHeader.GetValue(fhFileInfoLength);
int4 address = FileHeaderSize;
if (length+FileHeaderSize<=size)
{ DbxFileInfo inf(inm,address,length);
if (wantfolders) okay=fileHeader.isFolders();
else okay=!fileHeader.isFolders();
}
}
catch (...)
{
}
inm.close();
return okay;
}
bool IsValidDbxFolderFile(const string fn) {return IsValidDbxFile(fn,true);}
bool IsValidDbxMessageFile(const string fn) {return IsValidDbxFile(fn,false);}
8. 求助:outlook 2003 怎麼編輯html郵件,內部查看源代碼
首先,你可以用任意一個HTML編輯器編寫HTML郵件正文,把它保存為.htm文件,然後利用下列方法之一把它放入Outlook郵件:
選擇Outlook菜單「工具/選項」,在「郵件格式」選項卡中確保默認的郵件格式是HTML。然後,用IE打開包含郵件內容的.htm文件,選擇IE菜單「文件/發送/電子郵件頁面」。
在Outlook中,創建一個HTML格式的新郵件。用IE打開包含郵件內容的.htm文檔,選擇菜單「編輯/全選」、「編輯/復制」。切換到Outlook,點擊郵件正文區域,選擇菜單「編輯/粘貼」。
在Outlook中,創建一個HTML格式的新郵件,選擇菜單「插入/文件」。在「插入文件」對話框中,選擇包含郵件內容的.htm文件,然後點擊「插入」按鈕右邊小箭頭,選擇菜單「作為文本插入」。
另外一種辦法是用Word 2002/2000創建HTML文檔。在Word中編寫好文檔後,選擇Word菜單「文件/發送/郵件收件人」,這時Word文檔上面會出現「收件人」、「抄送」、「主題」等輸入框。發送郵件時,Word將使用HTML格式。遺憾的是,Word 2000會在HTML郵件中嵌入大量XML格式信息,達到數K之多,大大增加了郵件體積。但Word 2002提供了剝離這些XML代碼的方法,該選項可按如下步驟設置:選擇菜單「工具/選項」,選擇「常規」選項卡下面的「電子郵件選項」,然後選中「常規」選項卡下面的「發送前篩選HTML」。
9. outlook 編輯網頁源代碼
無法復制的網頁,筆者提供以下幾種方法供大家選用(以IE(2)使用記事本查看網頁的源代碼: 方法同(1「編輯→粘貼」,即可將網頁保存下來。 當遇到