HOME FORUMS MEMBERS RECENT POSTS LOG IN  
× Авторизация
Имя пользователя:
Пароль:
Нет аккаунта? Регистрация
НОВЫЕ ТОРГОВАЯ НОВОСТИ ЧАТ
loading...
Скрыть
Вернуться   ANTICHAT > ПРОГРАММИРОВАНИЕ > С/С++, C#, Rust, Swift, Go, Java, Perl, Ruby
   
Ответ
 
Опции темы Поиск в этой теме Опции просмотра

Отправить письмо.vb.net
  #1  
Старый 15.11.2009, 14:28
DJ4J
Познающий
Регистрация: 23.08.2009
Сообщений: 93
С нами: 8798638

Репутация: 71
По умолчанию Отправить письмо.vb.net

подскажите плиз как отправлять письмо на мыло из vb.net
пробовал сам писать,вообще не компилирует
и поподробнее плз)
 
Ответить с цитированием

  #2  
Старый 17.11.2009, 06:03
DeaD_MoroZ
Banned
Регистрация: 03.11.2009
Сообщений: 112
С нами: 8694756

Репутация: 17
По умолчанию

Код:
'Read the text of message and signature from txt-file "MessText.txt" 
 
Set fso = CreateObject("Scripting.FileSystemObject") 
'Open the file for reading 
Set f = fso.OpenTextFile("c:\Apps\MessText.txt", ForReading) 
'The ReadAll method reads the entire file into the variable BodyText 
MessText = f.ReadAll 
'Close the file 
f.Close 
Set f = Nothing 
Set fso = Nothing 
'____________________________________________________________________________________ 
 
'Read the recipients of Distribution List from txt-file: 
Set fso = CreateObject("Scripting.FileSystemObject") 
Set f = fso.OpenTextFile("c:\Apps\DistrList.txt", ForReading) 
DistribList = f.ReadAll 
f.Close 
Set f = Nothing 
Set fso = Nothing 
'____________________________________________________________________________________ 
 
 
AttFile = ("C:\Apps\Temp\Test_attach.txt")          'Path to file-attachment 
Set objEmail = WScript.CreateObject("CDO.Message")  'Create CDO-object and get link on it into objEmail (var) 
 
'''''''''''''''''''''''''''''''''''''''''''''''''''' 
' Required parameters of CDO-object 
'''''''''''''''''''''''''''''''''''''''''''''''''''' 
objEmail.From = "MyAddress@shell.com"                         'Sender (mine) address 
'objEmail.To = DistribList                                    'Address of recipient or distribution list 
objEmail.BCC = "address@mail.com"                             'Hide copy recipient address 
objEmail.Subject = "Field Management Report " & DateSubj      'Subject of message 
objEmail.AddAttachment = AttFile                              'Attachment 
objEmail.TextBody = MessText                                  'Message Text 
objEmail.BodyPart.Charset = "windows-1251"                    'Cyrillic encoding 
 
 
'Sending message using SMTP-service (1 - using of local SMTP-service) 
objEmail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2 
'Name of SMTP-server 
objEmail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "SLMCPF-S-01001" 
objEmail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = 2 
objEmail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/sendusername") = "MyAddress@shell.com" 
objEmail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/sendpassword") = "" 
 
 
 
objEmail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25  'Port of SMTP-server 
objEmail.Configuration.Fields.Update           'Update configuration of CDO-object 
objEmail.Send    'Sending of message by using Send-method

Последний раз редактировалось slesh; 17.11.2009 в 10:54.. Причина: [code] Код [/code]
 
Ответить с цитированием
Ответ



Предыдущая тема Следующая тема
Похожие темы
Тема Автор Раздел Ответов Последнее сообщение
Как проще отправить xml на сервер используя php5? case PHP 2 10.02.2009 19:50
Как анонимно отправить почту с помощью аутлука? Anti-DTF Уязвимости Mail-сервис 35 13.12.2005 16:21



Здесь присутствуют: 1 (пользователей: 0 , гостей: 1)
 


Быстрый переход




ANTICHAT ™ © 2001- Antichat Kft.