In support of this thread:
http://www.excelfox.com/forum/showth...ified-email-id
( Details: https://stackoverflow.com/questions/...51963#55451963 )
Current working ( gmail send ) pro macro, October 2019
Code:' Sub PetrasDailyProWay1_COM_Way(ByVal SmptySvrPrt) ' Allow access to deep down cods wollops from Microsoft to collaborating in particular in the form of messaging. An available library of ddl library functions and associated things is available on request, the Microsoft CDO for Windows 2000. We require some of these ' CDO is an object library that exposes the interfaces of the Messaging Application Programming Interface (MAPI). API: interfaces that are fairly easy to use from a fairly higher level from within a higher level programming language. In other words this allows you to get at and use some of the stuff to do with the COM OLE Bollocks from within a programming language such as VBA API is often referring loosely to do with using certain shipped with Windows software in Folders often having the extension dll. This extension , or rather the dll stands for direct link libraries. These are special sort of executable files of functions shared by many other (Windows based usually) software's. Call DieseArbeitsmappe1.FillMeGlobsUpMate ' Rem1 The deep down fundamental stuff , which includes stuff been there the longest goes by the name of Component Object Model. Stuff which is often, but not always, later stuff, or at a slightly higher level of the computer workings, or slightly more to a specific application ( an actual running "runtime" usage / at an instance in time , "instance of" ) orientated goes to the name of Object Linking and Embedding. At this lower level, there are protocols for communicating between things, and things relate are grouped into the to Office application available Library, CDO. An important object there goes by the name of Message. 'Rem 1) Library made available ====================# With CreateObject("CDO.Message") ' Folders mostly but not always are in some way referenced using dll, either as noted with the extension or maybe refered to as dll Files or dll API files. 'Rem 2 ' Intraction protocols are given requird infomation and then set '2a) 'With --------------------* my Created LCDCW Library, (LCD 1.0 Library ) (Linking Configuration Data_Cods Wollups) which are used and items configured for the Exchange at Microsoft's protocol thereof; http://schemas.microsoft.com/cdo/configuration/ ......This section provides the configuration information for the remote SMTP server Dim LCD_CW As String: Let LCD_CW = "http://schemas.microsoft.com/cdo/configuration/" ' Linking Configuration Data : defines the majority of fields used to set configurations for various Linking Collaboration (LCD) Objects Cods Wollops: These configuration fields are set using an implementation of the IConfiguration.Fields collection. https://msdn.microsoft.com/en-us/library/ms872853(v=exchg.65).aspx .Configuration(LCD_CW & "smtpusessl") = True ' ' ' HTTPS (Hyper Text Transfer Protocol Secure) appears in the URL when a website is secured by an SSL certificate. The details of the certificate, including the issuing authority and the corporate name of the website owner, can be viewed by clicking on the lock symbol on the browser bar. in short, it's the standard technology for keeping an internet connection secure and safeguarding any sensitive data that is being sent between two systems, preventing criminals from reading and modifying any information transferred, including potential personal details. ' SSL protocol has always been used to encrypt and secure transmitted data .Configuration(LCD_CW & "smtpauthenticate") = 1 ' ... possibly this also needed .. When you also get the Authentication Required Error you can add this three lines. ' ' Sever info .Configuration(LCD_CW & "smtpserver") = "smtp.gmail.com" ' "securesmtp.t-online.de" '"smtp.gmail.com" "smtp.mail.yahoo.com" "smtp.live.com" "pod51017.outlook.com" "smtp-mail.outlook.com" "smtp.live.com" "securesmtp.t-online.de" 465 SMTP is just used to mean the common stuff..... Simple Mail Transport Protocol (SMTP) server is used to send outgoing e-mails. The SMTP server receives emails from your Mail program and sends them over the Internet to their destination. ' The mechanism to use to send messages. .Configuration(LCD_CW & "sendusing") = 2 ' Based on the LCD_OLE Data Base of type DBTYPE_I4 .Configuration(LCD_CW & "smtpserverport") = SmptySvrPrt ' 465 or 25 for t-online.de ' 465 'or 587 'or 25 ' The port of type somehow refered to by the last line ' .Configuration(LCD_CW & "sendusername") = "123456789012345678909123456@gmail.com" '"123456789012@gmail.com" ' "12345678901@gmail.com" ' "123456789012@t-online.de" ' .... "server rejected your response". AFAIK : This will happen if you haven't setup an account in Outlook Express or Windows Mail .... Runtime error '-2147220975 (800440211)': The message could not be sent to the SMTP server. The transport error code is 0x80040217. The server response is not available .Configuration(LCD_CW & "sendpassword") = "123456789012345678" ' "1234567890123" ' ' "123456789012345" ' "12345678901" ' Optional - How long to try ( End remote SMTP server configuration section ) .Configuration(LCD_CW & "smtpconnectiontimeout") = 30 ' Or there Abouts ;) :) ' Intraction protocol is Set/ Updated .Configuration.Fields.Update ' 'Not all infomation is given, some will have defaults. - possibly this might be needed initially .. .Configuration.Load -1 ' CDO Source Defaults 'End With ' -------------------* my Created LCDCW Library ( Linking Configuration Data Cods Wollups) which are used and items configured for the Exchange at Microsoft's protocol therof; '2b) ' Data to be sent '.To = "123456@gmail.com" .To = "123456789012@t-online.de" '.To = "12345678901@gmail.com" .cc = "123456789012@gmail.com" .BCC = "" .from = """Stinkpflopp"" <12345678901234567890123456@gmail.com>" .Subject = "Pro für " & DieseArbeitsmappe1.LisWbProWb.Name '.TextBody = "Hi" & vbNewLine & vbNewLine & "Please find the Excel workbook attached." .HTMLBody = MyLengthyStreaming '.htmlbody = ProTble ' Add all text file attachments Dim DirTxtFl As String: Let DirTxtFl = Dir(ThisWorkbook.Path & "\" & "*.txt") Do While DirTxtFl <> "" If VBA.Left$(DirTxtFl, 22) = "MonatsUebersichtAnhang" Then .AddAttachment ThisWorkbook.Path & "\" & DirTxtFl Let DirTxtFl = Dir Loop '.AddAttachment ThisDocument.Path & "\MallaMessage2.docm" '"G:\ALERMK2014Marz2016\NeueBlancoAb27.01.2014\AbJan2016\Übersicht aktuell.xlsx" ' ' Full File path and name. File must be closed '.AddAttachment ThisDocument.Path & "\MallaMessage2.txt" Rem 3 Do it initially attempt with 25 , then in Malta as well maybe with 465 On Error GoTo Malta ' Intended to catch a possible predicted error in the next line when running the routine in Malta, or/ and an error in the second attempt at a code run ' if the next line errors, then I scheduule the routine to run again with "smtpserverport") = 465 .send On Error GoTo 0 MsgBox Prompt:="Done (with " & SmptySvrPrt & ")" ' This will typically give either "Done (with 25)" or else "Done (with 465)" if the routine worked End With ' CreateObject("CDO.Message") (Rem 1 Library End =======# Exit Sub ' Normal routine end for no error exceptional errected situation Malta: ' Intended to catch a predicted error when running the routine in Malta, or/ and an error in the second attempt at a code run If SmptySvrPrt = "465" Then MsgBox Prompt:="Also did not work with 465 , Oh Poo!": Exit Sub ' case error with attempt with 465 Application.OnTime Now(), "'" & ThisWorkbook.Path & "\" & "NeuProAktuelleMakros.xlsm'" & "!'ProAktuelleMacrosMtsch.PetrasDailyProWay1_COM_Way ""465""'" ' On Error GoTo -1: On Error GoTo 0 ' I do not need this as the End Sub will effectively bring down the errection state End Sub Sub plopy(ByVal stink As String)




Reply With Quote
Bookmarks