Форум: "Сети";
Текущий архив: 2004.04.11;
Скачать: [xml.tar.bz2];
ВнизКак превратьть это в робочее состояние? Найти похожие ветки
← →
Djon007 © (2004-02-06 20:18) [0]Добрый вечер.Как превратьть это в робочее состояние?
uses ComObj; {Delphi 5}
procedure TForm1.Button1Click(Sender: TObject);
const
// константы OlItemType
olMailItem = 0;
olAppointmentItem = 1;
olContactItem = 2;
olTaskItem = 3;
olJournalItem = 4;
olNoteItem = 5;
olPostItem = 6;
// константы OlAttachmentType
olByValue = 1;
olByReference = 4;
olEmbeddedItem = 5;
olOLE = 6;
var
myOlApp, myItem, myRecipient, myAttachments: OleVariant;
begin
// файл VBScript для создания почтового сообщения и прикрепления к нему файла
myOlApp := CreateOLEObject("Outlook.Application");
myItem := myOlApp.CreateItem(olMailItem);
myItem.Subject := "This is the Subject";
myRecipient := myItem.Recipients.Add("recipientaddress@recipienthost.com");
myItem.Body := #13;
myItem.Body := myItem.Body + #13;
myItem.Body := myItem.Body + "Hello," + #13;
myItem.Body := myItem.Body + "This code created this message and "+
" sent it and I didn""t even have" + #13;
myItem.Body := myItem.Body + "to click the send button!!!" + #13;
myItem.Body := myItem.Body + #13;
myItem.Body := myItem.Body + "If you have any more problems, let me know" +
#13;
myItem.Body := myItem.Body + "rename to blah.vbs and run like this:" + #13;
myItem.Body := myItem.Body + "wscript c:\blah.vbs" + #13;
myItem.Body := myItem.Body + #13;
myItem.Body := myItem.Body + "Eddie" + #13;
myItem.Body := myItem.Body + #13;
myItem.Body := myItem.Body + #13;
myItem.Body := myItem.Body + "const"+ #13;
myItem.Body := myItem.Body + " // константы OlItemType"+ #13;
myItem.Body := myItem.Body + " olMailItem = 0;"+ #13;
myItem.Body := myItem.Body + " olAppointmentItem = 1;"+ #13;
myItem.Body := myItem.Body + " olContactItem = 2;"+ #13;
myItem.Body := myItem.Body + " olTaskItem = 3;"+ #13;
myItem.Body := myItem.Body + " olJournalItem = 4;"+ #13;
myItem.Body := myItem.Body + " olNoteItem = 5;"+ #13;
myItem.Body := myItem.Body + " olPostItem = 6;"+ #13;
myItem.Body := myItem.Body + " // OlAttachmentType constants"+ #13;
myItem.Body := myItem.Body + " olByValue = 1;"+ #13;
myItem.Body := myItem.Body + " olByReference = 4;"+ #13;
myItem.Body := myItem.Body + " olEmbeddedItem = 5;"+ #13;
myItem.Body := myItem.Body + " olOLE = 6;"+ #13;
myItem.Body := myItem.Body + #13;
myItem.Body := myItem.Body + "var"+ #13;
myItem.Body := myItem.Body + " myOlApp, myItem, myRecipient, myAttachments:
OleVariant;"+ #13;
myItem.Body := myItem.Body + "begin"+ #13;
myItem.Body := myItem.Body + " myOlApp :=
CreateObject(""Outlook.Application"")" + #13;
myItem.Body := myItem.Body + " myItem := myOlApp.CreateItem(olMailItem)" +
#13;
myItem.Body := myItem.Body + " myItem.Subject := ""This is the Subject""" +
#13;
myItem.Body := myItem.Body + " myItem.Body := ""This is the body""" + #13;
myItem.Body := myItem.Body + " myRecipient := myItem.Recipients.Add
("recipientaddress@recipienthost.com")" + #13;
myItem.Body := myItem.Body + " myAttachments := myItem.Attachments" + #13;
myItem.Body := myItem.Body + " // Теперь прикрепим файлы..." + #13;
myItem.Body := myItem.Body + " myAttachments.Add ""C:\blah.txt"", olByValue,
1, ""Blah.txt Attachment""" + #13;
myItem.Body := myItem.Body + " myItem.Send" + #13;
myItem.Body := myItem.Body + " myOlApp := VarNull;" + #13;
myItem.Body := myItem.Body + " myItem := VarNull;" + #13;
myItem.Body := myItem.Body + " myRecipient := VarNull;" + #13;
myItem.Body := myItem.Body + " myAttachments := VarNull;" + #13;
myItem.Body := myItem.Body + "end;" + #13;
// Теперь прикрепим файлы...
myAttachments := myItem.Attachments;
myAttachments.Add("C:\blah.txt", olByValue, 1, "Blah.txt Attachment");
myItem.Send
myOlApp := VarNull;
myItem := VarNull;
myRecipient := VarNull;
myAttachments := VarNull;
end;
← →
Djon007 © (2004-02-06 21:44) [1]неужели мне никто не поможет?
Отправка E-mail с прикреплённым файлом из Delphi через Outlook.
как?
Страницы: 1 вся ветка
Форум: "Сети";
Текущий архив: 2004.04.11;
Скачать: [xml.tar.bz2];
Память: 0.45 MB
Время: 0.043 c