🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: pl.comp.bazy-danych.msaccess
Article #137583

Re: Wysyłanie maila przez Office Outlook 2016

#137583
From: minfo
Date: Fri, 20 Apr 2018 18:08
56 lines
3237 bytes
Kiedyś pisałem coś jak poniżej ale to było w vb.net:
***

Option Explicit

'============================================================
' Wymaga referencji do Microsoft CDO for Windows 2000 Library

' Przy pierwszym uruchomieniu jest blokowane przez Gmail
' Gmail wysyła maila o próbie użycia konta
' W tym mailu daje link umożliwiający działanie tego kodu
' https://www.google.com/settings/security/lesssecureapps
' z ostrzeżeniem, że konto nie będzie dłużej chronione
' zgodnie z nowoczesnymi standardami. - wybór należy do nas :)
'=============================================================
Sub WyslijGmail()
    Dim MojMail As New CDO.Message
    Const ADRES As String = _
        "http://schemas.microsoft.com/cdo/configuration/"
    
    On Error GoTo Obsluga
    
    With MojMail.Configuration.Fields
        .Item(ADRES & "smtpusessl") = True
        .Item(ADRES & "smtpauthenticate") = 1
        .Item(ADRES & "smtpserver") = "smtp.gmail.com"
        .Item(ADRES & "smtpserverport") = 25
        .Item(ADRES & "sendusing") = 2
        .Item(ADRES & "sendusername") = "twoje_konto@gmail.com"
        .Item(ADRES & "sendpassword") = "twoje_haslo"
        .Update
    End With
    With MojMail
        .Subject = "Temacik"
        .To = "konto_odbiorcy@gmail.com"
        .From = "twoje_konto@gmail.com"
        .TextBody = "Pozdrowienia z VBA przez Gmail :)"
        .AddAttachment "C:\EX04\test.txt"
        .Send
    End With
    
    MsgBox "Poszło :)"
    
Czyszczenie:
    On Error Resume Next
    Set MojMail = Nothing
    Exit Sub
Obsluga:
    MsgBox Err & " - " & Err.Description
    Resume Czyszczenie
End Sub



***
MF
Technical Details
Message-ID: <720ed644-cdff-42a3-8160-5e63935586a2@googlegroups.com>
Path: mbox-mo1.pugleaf.net!news-archive.icm.edu.pl!news.icm.edu.pl!news.nask.pl!news.nask.org.pl!news.unit0.net!weretis.net!feeder6.news.weretis.net!feeder.usenetexpress.com!feeder-in1.iad1.usenetexpress.com!peer02.iad!feed-me.highwinds-media.com!news.highwinds-media.com!x25-v6no857736qto.0!news-out.google.com!p5-v6ni25779qtp.1!nntp.google.com!x25-v6no857735qto.0!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail
References: <4dbc08fa-1884-4f99-906c-be46261e59d6@googlegroups.com> <348b100f-6fa6-4ece-871a-aaaf2ef16590@googlegroups.com>

Show Full Headers
Complete Article Headers
X-Received: by 10.55.185.134 with SMTP id j128mr4665666qkf.58.1524247717373;        Fri, 20 Apr 2018 11:08:37 -0700 (PDT)
X-Received: by 10.31.170.141 with SMTP id t135mr1308358vke.2.1524247717085; Fri, 20 Apr 2018 11:08:37 -0700 (PDT)
Path: mbox-mo1.pugleaf.net!news-archive.icm.edu.pl!news.icm.edu.pl!news.nask.pl!news.nask.org.pl!news.unit0.net!weretis.net!feeder6.news.weretis.net!feeder.usenetexpress.com!feeder-in1.iad1.usenetexpress.com!peer02.iad!feed-me.highwinds-media.com!news.highwinds-media.com!x25-v6no857736qto.0!news-out.google.com!p5-v6ni25779qtp.1!nntp.google.com!x25-v6no857735qto.0!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail
Newsgroups: pl.comp.bazy-danych.msaccess
Date: Fri, 20 Apr 2018 11:08:36 -0700 (PDT)
In-Reply-To: <348b100f-6fa6-4ece-871a-aaaf2ef16590@googlegroups.com>
Complaints-To: groups-abuse@google.com
Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=79.163.136.41; posting-account=vYGi6woAAAA6NlWlzOm2dBNZ6sPJDKfx
NNTP-Posting-Host: 79.163.136.41
References: <4dbc08fa-1884-4f99-906c-be46261e59d6@googlegroups.com> <348b100f-6fa6-4ece-871a-aaaf2ef16590@googlegroups.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <720ed644-cdff-42a3-8160-5e63935586a2@googlegroups.com>
Subject: Re: Wysyłanie maila przez Office Outlook 2016
From: minfo@onet.pl
Injection-Date: Fri, 20 Apr 2018 18:08:37 +0000
X-Received-Bytes: 3330
X-Received-Body-CRC: 1154545705
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit