Visual Basic, .NET, ASP, VBScript
 

   
   
     

Форум - Общий форум

Страница: 1 |

 

  Вопрос: Как прицепить файл к письму Добавлено: 01.06.04 21:15  

Автор вопроса:  __Сергей__
Пользую-
Call ShellExecute(0&, "Open", "mailto:" + "
mail99@mail.ru" & "?Subject=" & "'Здесь описана тема...'" & "?body=" & "'здесь нужно написать сообщение'" & "?a=" & "c:\vc.com", "", "", 1)
тема не полностью, тела письма вообще нет, а самое главное файл не аттачится,
Пользую Express Outlook 97 (работа такая) да и с The Bat пробовал - ни фига.
В MSDN нету, про это. MAPI не желателен.
Может кто скажет, а лучше вышлет? (Ну на крайняк с MAPI).

Ответить

  Ответы Всего ответов: 3  

Номер ответа: 1
Автор ответа:
 astoro



ICQ: 649109 

Вопросов: 31
Ответов: 391
 Профиль | | #1 Добавлено: 02.06.04 06:32
Через MAPI так:

Public Function send_mail(sendto As String, _
subject As String, _
text As String) As Boolean

On Error GoTo ErrHandler
    With MAPISession1
        .DownLoadMail = False
        .LogonUI = True
        .SignOn
        .NewSession = True
        MAPIMessages1.SessionID = .SessionID
            
    End With
    With MAPIMessages1
        .Compose
        .RecipAddress = sendto
        .AddressResolveUI = True
        .ResolveName
        .MsgSubject = subject
        .MsgNoteText = text
        .AttachmentPathName = File1
        .AttachmentPathName = File2
        .AttachmentPathName = File3
        .Send False
    End With
send_mail=True
MAPIMessages1.SessionID = 0
MAPISession1.SignOff
Exit Function

ErrHandler:
send_mail=False
End Function

Private Sub Command1_Click()
If MsgBox("Отправить письмо?", vbYesNo + _
vbQuestion) = vbNo Then Exit Sub
a = send_mail ("email@email.ru", "Subject", "Привет" + _
vbCrLf + "Проверка связи!";)
Select Case a
Case True
    MsgBox ("Письма отправлены!";)
Case False
    MsgBox ("Письма не отправлены!";)
End Select
End Sub

Ответить

Номер ответа: 2
Автор ответа:
 Gloom



Вопросов: 0
Ответов: 36
 Профиль | | #2 Добавлено: 02.06.04 12:56

Пример:

http://www.vb-helper.com/howto_send_outlook_express_attachment.html

Single Command-Line String for a Message with Subject and Body

NOTE: The procedures that are outlined in this section assume that the you are familiar with creating the type of objects listed in the implementation list.

In order to create a preformatted and pre-addressed e-mail message, it is necessary to build a command-line string with the following parameters:

mailto:<to email>?cc=<cc email>&bcc=<bcc
mail>&subject=<subject text>&body=<body text>

Where the following variable definitions apply:

   Variable                        Field Entry
   --------------------------------------------------------------
   <to e-mail>          e-mail address to appear in the To field
   <cc mail>            e-mail address to appear in the CC field
   <bcc mail>           e-mail address to appear in the BCC field
   <subject>            text to appear in the Subject field
   <body text>          text to appear in the Body of the message

				

Note the position of the question mark (?) and ampersand (&;) characters in the command-line syntax.

In addition to the field designations, you must use ASCII hexadecimal equivalents as variables for punctuation characters. The following variables are used to represent commonly used characters:

Space ( ) %20
Comma (,) %2C
Question Mark (?) %3F
Period (.) %2E
Exclamation Point (!) %21
Colon (:) %3A
Semicolon (;) %3B

The following is an example of a command-line for the Subject and Body text using these variables:

   &subject=Hello%20World%21&body=How%20are%20you%2C%20John%3F
				

This command-line yields the following information:

Subject: Hello World!
Body : How are you, John?

Ответить

Номер ответа: 3
Автор ответа:
 tvy



Вопросов: 4
Ответов: 2
 Профиль | | #3 Добавлено: 02.06.04 15:43
Можно через CDO. в MSDN есть. Объект Newmail.
Свойство .Attachment="c:\test.txt"

Ответить

Страница: 1 |

Поиск по форуму



© Copyright 2002-2011 VBNet.RU | Пишите нам