Hi everyone

I've got a list of files which need to be sent to various mail recipients. I can get this to work via Outlook (using Ron de Bruins code). However, as there is confidential information I need to send this via NHS.net. My NHS.net account is configured to work via Outlook.

This is Ron's code I'm using

Sub Send_Files()
'Working in 2000-2010
    Dim OutApp As Object
    Dim OutMail As Object
    Dim sh As Worksheet
    Dim cell As Range, FileCell As Range, rng As Range

    With Application
        .EnableEvents = False
        .ScreenUpdating = False
    End With

    Set sh = Sheets("Sheet1")

    Set OutApp = CreateObject("Outlook.Application")

    For Each cell In sh.Columns("B").Cells.SpecialCells(xlCellTypeConstants)

        'Enter the file names in the C:Z column in each row
        Set rng = sh.Cells(cell.Row, 1).Range("C1:Z1")

        If cell.Value Like "?*@?*.?*" And _
           Application.WorksheetFunction.CountA(rng) > 0 Then
            Set OutMail = OutApp.CreateItem(0)

            With OutMail
                .To = cell.Value
                .Subject = "Testfile"
                .Body = "Hi " & cell.Offset(0, -1).Value
                
                For Each FileCell In rng.SpecialCells(xlCellTypeConstants)
                    If Trim(FileCell) <> "" Then
                        If Dir(FileCell.Value) <> "" Then
                            .Attachments.Add FileCell.Value
                        End If
                    End If
                Next FileCell
                
                .Send  'Or use Display
            End With

            Set OutMail = Nothing
        End If
    Next cell

    Set OutApp = Nothing

    With Application
        .EnableEvents = True
        .ScreenUpdating = True
    End With
End Sub
This is some code I've found which looks like it might be along the lines of what I need. Am thinking I would need the MailBee program too? Would be grateful for an explanation, appreciate I'm out of my depth here!

oSMTP=CREATEOBJECT("MailBee.SMTP") 
oSSL = CreateObject("MailBee.SSL") 

oSMTP.EnableLogging = .t. 
oSMTP.LogFilePath = "C:\temp\smtp_log.txt" 
oSMTP.ClearLog 

oSmtp.LicenseKey = "My trial key" 
oSSL.LicenseKey = "My trial key" 

oSmtp.ServerName = "SMTP1.NHS.NET" 
oSmtp.FromAddr = "[email protected]" 
oSmtp.portnumber = 25 
oSmtp.UserName = "my username" 
oSmtp.Password = "my password" 

oSmtp.ssl = oSSL 
oSmtp.ssl.UseStartTLS = .t. 

If oSMTP.Connect 
MESSAGEBOX("connect Error: "+ osmtp.ErrDesc) 
oSmtp.disconnect 
MODIFY COMMAND c:\temp\smtp_log.txt 
ELSE 
     oSmtp.ToAddr = "[email protected]" 
     oSmtp.Subject = "test" 
     oSmtp.BodyText = "test body" 

     If oSMTP.Send 
           oSMTP.Disconnect 
     else 
      MESSAGEBOX(osmtp.ErrDesc) 
      MODIFY COMMAND c:\temp\smtp_log.txt 
     ENDIF 
endif