Results 1 to 30 of 30

Thread: Local Emailing Without an Email Client

  1. #1

    Thread Starter
    Fanatic Member
    Join Date
    Apr 2008
    Location
    Kent, England
    Posts
    713

    Local Emailing Without an Email Client

    Hi Guys, I have seen various references to vbMailSend.dll, and have taken an interest, I want to incorporate local emailing into an application I am writing, but I havent the foggiest where to start.

    the problem is it will need to be compatible with Exchange, or at worst case scenario, I may have to set up an SMTP server, but I really dont want to do this. The other thing is, If I can get away with it I dont want to use a webmail method.

    I have read various things about winsocks and SSL, but havent a clue where to start. I downloaded and read the vbSendMail help guide, but short of the first couple of pages that just shows you the working example (and after trying to run the only project that would open and play with a form interface) I am still no wiser. Has anyone any suggestions? if this sendmail is the way to go, can anyone tell me which references need setting up, which of these modules I have downloaded I should be incorporating into the project, and generally if I am in well over my head...

    Thanks

    J
    "Wisdom is only truly achieved, when you realise you dont know everything" ... I must be a genius because I always have to ask stupid questions...

    Pointing an idiot like me in the right direction, is always appreciated by the idiot, explaining how to do what you have pointed the idiot to, is appreciated even more. I apologise to all experienced coders who will think I am an idiot, you are right, I am an idiot, but I am an idiot who is trying to learn

  2. #2
    Discovering Life Siddharth Rout's Avatar
    Join Date
    Feb 2005
    Location
    Mumbai, India
    Posts
    12,001

    Re: Local Emailing Without an Email Client

    Hi Guys, I have seen various references to vbMailSend.dll
    Did you go thru this link?

    http://www.freevbcode.com/ShowCode.Asp?ID=109
    A good exercise for the Heart is to bend down and help another up...
    Please Mark your Thread "Resolved", if the query is solved


    MyGear:
    ★ CPU ★ Ryzen 5 5800X
    ★ GPU ★ NVIDIA GeForce RTX 3080 TI Founder Edition
    ★ RAM ★ G. Skill Trident Z RGB 32GB 3600MHz
    ★ MB ★ ASUS TUF GAMING X570 (WI-FI) ATX Gaming
    ★ Storage ★ SSD SB-ROCKET-1TB + SEAGATE 2TB Barracuda IHD
    ★ Cooling ★ NOCTUA NH-D15 CHROMAX BLACK 140mm + 10 of Noctua NF-F12 PWM
    ★ PSU ★ ANTEC HCG-1000-EXTREME 1000 Watt 80 Plus Gold Fully Modular PSU
    ★ Case ★ LIAN LI PC-O11 DYNAMIC XL ROG (BLACK) (G99.O11DXL-X)
    ★ Monitor ★ LG Ultragear 27" 240Hz Gaming Monitor
    ★ Keyboard ★ TVS Electronics Gold Keyboard
    ★ Mouse ★ Logitech G502 Hero

  3. #3

    Thread Starter
    Fanatic Member
    Join Date
    Apr 2008
    Location
    Kent, England
    Posts
    713

    Re: Local Emailing Without an Email Client

    I believe I did yes, (hope thats not considered treason in VBforums )
    "Wisdom is only truly achieved, when you realise you dont know everything" ... I must be a genius because I always have to ask stupid questions...

    Pointing an idiot like me in the right direction, is always appreciated by the idiot, explaining how to do what you have pointed the idiot to, is appreciated even more. I apologise to all experienced coders who will think I am an idiot, you are right, I am an idiot, but I am an idiot who is trying to learn

  4. #4
    Discovering Life Siddharth Rout's Avatar
    Join Date
    Feb 2005
    Location
    Mumbai, India
    Posts
    12,001

    Re: Local Emailing Without an Email Client

    Doesn't that work for you.?
    A good exercise for the Heart is to bend down and help another up...
    Please Mark your Thread "Resolved", if the query is solved


    MyGear:
    ★ CPU ★ Ryzen 5 5800X
    ★ GPU ★ NVIDIA GeForce RTX 3080 TI Founder Edition
    ★ RAM ★ G. Skill Trident Z RGB 32GB 3600MHz
    ★ MB ★ ASUS TUF GAMING X570 (WI-FI) ATX Gaming
    ★ Storage ★ SSD SB-ROCKET-1TB + SEAGATE 2TB Barracuda IHD
    ★ Cooling ★ NOCTUA NH-D15 CHROMAX BLACK 140mm + 10 of Noctua NF-F12 PWM
    ★ PSU ★ ANTEC HCG-1000-EXTREME 1000 Watt 80 Plus Gold Fully Modular PSU
    ★ Case ★ LIAN LI PC-O11 DYNAMIC XL ROG (BLACK) (G99.O11DXL-X)
    ★ Monitor ★ LG Ultragear 27" 240Hz Gaming Monitor
    ★ Keyboard ★ TVS Electronics Gold Keyboard
    ★ Mouse ★ Logitech G502 Hero

  5. #5

    Thread Starter
    Fanatic Member
    Join Date
    Apr 2008
    Location
    Kent, England
    Posts
    713

    Re: Local Emailing Without an Email Client

    well I did try.

    1) the single email example, opened but when i ran the app and tried to connect it timed out, I registered the DLL's but couldnt work out what else needed to be done to it.

    2) I tried opening the "vbsendmail.vbp" file, but it opened without a form, and I tried to look through but I couldnt find how I was meant to combine it into my project.

    On top of that I tried to look into using it with Exchange, the problem is I cant find out what my pop / smtp settings would be for our local Exchange server, nor do I know if I am looking for something that doesnt exist?

    J
    "Wisdom is only truly achieved, when you realise you dont know everything" ... I must be a genius because I always have to ask stupid questions...

    Pointing an idiot like me in the right direction, is always appreciated by the idiot, explaining how to do what you have pointed the idiot to, is appreciated even more. I apologise to all experienced coders who will think I am an idiot, you are right, I am an idiot, but I am an idiot who is trying to learn

  6. #6

    Thread Starter
    Fanatic Member
    Join Date
    Apr 2008
    Location
    Kent, England
    Posts
    713

    Re: Local Emailing Without an Email Client

    I have seen that there are several posts around this forum, which have been left unanswered, so I am hoping I am not asking for too much. All I want to do is, incorporate the key components into my project, even if I use the "sendMailExample" form and just prefill the boxes and initiate the form.

    Is this asking too much do you think?
    "Wisdom is only truly achieved, when you realise you dont know everything" ... I must be a genius because I always have to ask stupid questions...

    Pointing an idiot like me in the right direction, is always appreciated by the idiot, explaining how to do what you have pointed the idiot to, is appreciated even more. I apologise to all experienced coders who will think I am an idiot, you are right, I am an idiot, but I am an idiot who is trying to learn

  7. #7
    PowerPoster
    Join Date
    Dec 2004
    Posts
    25,618

    Re: Local Emailing Without an Email Client

    check if there is a vbg file, which is a group project and will demonstrate the class

    i have used vbsendmail without problem, sending html emails with attachments

    you have to specify your smtp server and a few other settings before you can send mail
    you can check the server settings in for exchange in outlook or whatever client you use to read your normal mails
    comprehensive help files are included, in a word document i think
    i do my best to test code works before i post it, but sometimes am unable to do so for some reason, and usually say so if this is the case.
    Note code snippets posted are just that and do not include error handling that is required in real world applications, but avoid On Error Resume Next

    dim all variables as required as often i have done so elsewhere in my code but only posted the relevant part

    come back and mark your original post as resolved if your problem is fixed
    pete

  8. #8

    Thread Starter
    Fanatic Member
    Join Date
    Apr 2008
    Location
    Kent, England
    Posts
    713

    Re: Local Emailing Without an Email Client

    I managed to open the example.exe file, and it works with simpleSMTP server on port 25, however I just want to incorporate it into my project. I have opened the vbg file, and had a look and I can see the class files you are referring to, but how do I operate it? am I meant to use the "Send Mail Example" and just manage the text boxes with variables? I have read the documentation that came with it, but I am not quite sure how to follow it.
    "Wisdom is only truly achieved, when you realise you dont know everything" ... I must be a genius because I always have to ask stupid questions...

    Pointing an idiot like me in the right direction, is always appreciated by the idiot, explaining how to do what you have pointed the idiot to, is appreciated even more. I apologise to all experienced coders who will think I am an idiot, you are right, I am an idiot, but I am an idiot who is trying to learn

  9. #9
    PowerPoster
    Join Date
    Dec 2004
    Posts
    25,618

    Re: Local Emailing Without an Email Client

    you can either include the class files of the sendmail project within your project
    which would be compiled within your prgram exe
    or
    include a reference to the vbsendmail.dll
    in this case the vbsendmail.dll would have to be included in your packaging to deploy to other computers
    i do my best to test code works before i post it, but sometimes am unable to do so for some reason, and usually say so if this is the case.
    Note code snippets posted are just that and do not include error handling that is required in real world applications, but avoid On Error Resume Next

    dim all variables as required as often i have done so elsewhere in my code but only posted the relevant part

    come back and mark your original post as resolved if your problem is fixed
    pete

  10. #10

    Thread Starter
    Fanatic Member
    Join Date
    Apr 2008
    Location
    Kent, England
    Posts
    713

    Re: Local Emailing Without an Email Client

    so if I import the vbg into my current project, and then try to run the form without importing the individual components, that should work?
    "Wisdom is only truly achieved, when you realise you dont know everything" ... I must be a genius because I always have to ask stupid questions...

    Pointing an idiot like me in the right direction, is always appreciated by the idiot, explaining how to do what you have pointed the idiot to, is appreciated even more. I apologise to all experienced coders who will think I am an idiot, you are right, I am an idiot, but I am an idiot who is trying to learn

  11. #11
    Member
    Join Date
    Oct 2009
    Location
    Pretoria, South Africa
    Posts
    38

    Re: Local Emailing Without an Email Client

    If all you want is your app to send mail you ccan use this

    I created a module with the following code:

    Code:
    Imports System.Net.Mail
    
    
    Public Module SendSMTP
        Public Sub SendSMTP(ByVal strFrom As String, ByVal strTo As String, ByVal strSubject As String, ByVal strBody As String, ByVal strCC As String, ByVal strAttachments As String)
            Dim insMail As New MailMessage(New MailAddress(strFrom), New MailAddress(strTo))
            With insMail
                .Subject = strSubject
                .Body = strBody
                '.CC.Add(New MailAddress(strCC))
                If Not strAttachments.Equals(String.Empty) Then
                    Dim strFile As String
                    Dim strAttach() As String = strAttachments.Split(";"c)
                    For Each strFile In strAttach
                        .Attachments.Add(New Attachment(strFile.Trim()))
                    Next
                End If
            End With
            Dim smtp As New System.Net.Mail.SmtpClient
            smtp.Host = "{yoursmtpserver}"
            smtp.Credentials = New System.Net.NetworkCredential("mysmtpauthusername", "mysmtpauthpass")
            smtp.Port = 25
            smtp.Send(insMail)
    
        End Sub
    End Module
    Then add this to your project and i think you get the idea

    Code:
    SendSMTP.SendSMTP(My.Settings.sms_auth_username, "[email protected]", my subject, mybody, "", "")
    I would like to take credit for this if someone else uises it but i got this from a post somewhere online.

    Hope this helps

  12. #12

    Thread Starter
    Fanatic Member
    Join Date
    Apr 2008
    Location
    Kent, England
    Posts
    713

    Re: Local Emailing Without an Email Client

    thanks shapeshift I will probably try that, do I need to include any particular references in the project?
    "Wisdom is only truly achieved, when you realise you dont know everything" ... I must be a genius because I always have to ask stupid questions...

    Pointing an idiot like me in the right direction, is always appreciated by the idiot, explaining how to do what you have pointed the idiot to, is appreciated even more. I apologise to all experienced coders who will think I am an idiot, you are right, I am an idiot, but I am an idiot who is trying to learn

  13. #13
    Member
    Join Date
    Oct 2009
    Location
    Pretoria, South Africa
    Posts
    38

    Re: Local Emailing Without an Email Client

    the is an include. on the module. it is included in the code just copy and paste

    if it doesnt work let me know and ill search my refs
    Last edited by ShapeShiftme; Nov 2nd, 2009 at 05:06 AM. Reason: oops

  14. #14

    Thread Starter
    Fanatic Member
    Join Date
    Apr 2008
    Location
    Kent, England
    Posts
    713

    Re: Local Emailing Without an Email Client

    so i dont need to add a reference like I would ActiveX DAO 2.5?
    "Wisdom is only truly achieved, when you realise you dont know everything" ... I must be a genius because I always have to ask stupid questions...

    Pointing an idiot like me in the right direction, is always appreciated by the idiot, explaining how to do what you have pointed the idiot to, is appreciated even more. I apologise to all experienced coders who will think I am an idiot, you are right, I am an idiot, but I am an idiot who is trying to learn

  15. #15
    Member
    Join Date
    Oct 2009
    Location
    Pretoria, South Africa
    Posts
    38

    Re: Local Emailing Without an Email Client

    beat me to an edit post. i dont remember if i had to put in a ref. if it doesnt work let me know and ill search my ref set

  16. #16
    PowerPoster
    Join Date
    Dec 2004
    Posts
    25,618

    Re: Local Emailing Without an Email Client

    that looks very much like vb.net code, won't work in vb6

    a very simple way to send emails is to use cdo.message
    you can use createobject("cdo.message")
    no references required
    do a search in this forum for examples,
    will work with secure smtp servers like gmail
    i do my best to test code works before i post it, but sometimes am unable to do so for some reason, and usually say so if this is the case.
    Note code snippets posted are just that and do not include error handling that is required in real world applications, but avoid On Error Resume Next

    dim all variables as required as often i have done so elsewhere in my code but only posted the relevant part

    come back and mark your original post as resolved if your problem is fixed
    pete

  17. #17
    Member
    Join Date
    Oct 2009
    Location
    Pretoria, South Africa
    Posts
    38

    Re: Local Emailing Without an Email Client

    Quote Originally Posted by westconn1 View Post
    that looks very much like vb.net code, won't work in vb6
    Very correct. Sorry didnt even notice "vb6" section
    Sorry i couldnt help then.

    Cheers

  18. #18

    Thread Starter
    Fanatic Member
    Join Date
    Apr 2008
    Location
    Kent, England
    Posts
    713

    Re: Local Emailing Without an Email Client

    I thought it might have been vb.net but to be honest I am a pap programmer, so I didnt think to question it! and thanks for that westconn1, I will give that a go later, shapeshift, I will give your code a go when I complete the app and then migrate it to .net after!
    "Wisdom is only truly achieved, when you realise you dont know everything" ... I must be a genius because I always have to ask stupid questions...

    Pointing an idiot like me in the right direction, is always appreciated by the idiot, explaining how to do what you have pointed the idiot to, is appreciated even more. I apologise to all experienced coders who will think I am an idiot, you are right, I am an idiot, but I am an idiot who is trying to learn

  19. #19

    Thread Starter
    Fanatic Member
    Join Date
    Apr 2008
    Location
    Kent, England
    Posts
    713

    Re: Local Emailing Without an Email Client

    I have just found this code below, but I cannot get it to work... When it opens, I get

    "Run Time Error '429':
    ActiveX component can't create object

    Code:
    Private Sub command1_click()
    call SendEmail("[email protected]","[email protected]", "test subject", "test email")
    end sub
    
    ' Sends an email to the appropriate person(s)
    '
    ' SendTo = List of email addresses separated by a semicolon.  Example:
    '                          [email protected]; [email protected]; [email protected]
    ' Subject = Text that summarizes what the email is about
    ' EmailText = Body of text that is the email
    ' AttachmentPath = Directory in which the attachment resides
    ' Attachment = File to send with the email
    
    Sub SendEmail(From As String, SendTo As String, Subject As String, _
        EmailText As String, Optional AttachmentPath As String, _
        Optional Attachment As String, Optional CC As String)
        Const constRoutine As String = "SendEmail"
    
        Dim strSendTo As String
        Dim objSendMail As CDONTS.NewMail
        Dim i As Integer
    
        On Error GoTo TryMAPI
        
        'Do not cause the user a major error, just log the error and keep going
        If SendTo = "" Then Exit Sub
    
        Set objSendMail = New CDONTS.NewMail
    
        With objSendMail
            On Error Resume Next
            .From = From
            If CC <> "" Then
                .CC = CC
            End If
    
            On Error GoTo ErrorHandler
            .To = SendTo
            .Subject = Subject
            .Body = EmailText
            AttachmentPath = Trim$(AttachmentPath)
            
            If AttachmentPath <> "" Then
                If Right$(AttachmentPath, 1) <> "\" Then
                    AttachmentPath = AttachmentPath & "\"
                End If
                .AttachFile (AttachmentPath & Attachment)
            End If
            .Send
        End With
    
        GoTo ExitMe
    
    TryMAPI:
        On Error GoTo ErrorHandler
    
        'If CDO fails, try MAPI
        If CC <> "" Then
            strSendTo = SendTo & "; " & CC
        Else
            strSendTo = SendTo
        End If
    
        Call SendEmailMAPI(SendTo:=strSendTo, Subject:=Subject, _
            EmailText:=EmailText)
    
    ExitMe:
        Set objSendMail = Nothing
        Exit Sub
    
    ErrorHandler:
        Err.Raise Err.Number, Err.Source, Err.Description
        Resume ExitMe
    
    End Sub
    
    ' Sends an email to the appropriate person(s).
    ' SendTo = List of email addresses separated by a semicolon.  Example:
    '                 [email protected]; [email protected]; [email protected]
    ' Subject = Text that summarizes what the email is about
    ' EmailText = Body of text that is the email
    ' AttachmentPath = Directory in which the attachment resides
    ' Attachment = File to send with the email
    
    Sub SendEmailMAPI(SendTo As String, Subject As String, EmailText As String, _
        Optional AttachmentPath As String, Optional Attachment As String)
       Const constRoutine As String = "SendEmailMAPI"
    
       Dim intStart As Integer
       Dim strSendTo As String
       Dim intEnd As Integer
       Dim i As Integer
    
       On Error GoTo ErrorHandler
       
       If frmEmailCommon.MAPISession.SessionID = 0 Then
          frmEmailCommon.MAPISession.SignOn
       End If
    
       If SendTo = "" Then Exit Sub
    
       With frmEmailCommon.MAPIMessages
          .SessionID = frmEmailCommon.MAPISession.SessionID
          .Compose
    
          'Make sure that the SendTo always has a trailing semi-colon (makes it 
          ' easier below)
          'Strip out any spaces between names for consistency
          For i = 1 To Len(SendTo)
             If Mid$(SendTo, i, 1) <> " " Then
                strSendTo = strSendTo & Mid$(SendTo, i, 1)
             End If
          Next i
    
          SendTo = strSendTo
          If Right$(SendTo, 1) <> ";" Then
             SendTo = SendTo & ";"
          End If
    
          'Format each recipient, each are separated by a semi-colon, like this:
          '  [email protected];[email protected]; [email protected];
          intEnd = InStr(1, SendTo, ";")
          .RecipAddress = Mid$(SendTo, 1, intEnd - 1)
          .ResolveName
    
          intStart = intEnd + 1
          Do
             intEnd = InStr(intStart, SendTo, ";")
             If intEnd = 0 Then
                Exit Do
             Else
                .RecipIndex = .RecipIndex + 1
                .RecipAddress = Mid$(SendTo, intStart, intEnd - intStart)
                .ResolveName
             End If
             intStart = intEnd + 1
          Loop
    
          .MsgSubject = Subject
          .MsgNoteText = EmailText
          If Left$(Attachment, 1) = "\" Then
             Attachment = Mid$(Attachment, 2, Len(Attachment))
          End If
    
          If Attachment <> "" Then
             If Right$(AttachmentPath, 1) = "\" Then
                .AttachmentPathName = AttachmentPath & Attachment
             Else
                .AttachmentPathName = AttachmentPath & "\" & Attachment
             End If
            .AttachmentName = Attachment
          End If
          .Send False
       End With
    
    ExitMe:
       Exit Sub
    
    ErrorHandler:
       Err.Raise Err.Number, m_constPgm & constRoutine, Err.Description 
       Resume ExitMe
    
    End Sub
    "Wisdom is only truly achieved, when you realise you dont know everything" ... I must be a genius because I always have to ask stupid questions...

    Pointing an idiot like me in the right direction, is always appreciated by the idiot, explaining how to do what you have pointed the idiot to, is appreciated even more. I apologise to all experienced coders who will think I am an idiot, you are right, I am an idiot, but I am an idiot who is trying to learn

  20. #20
    PowerPoster
    Join Date
    Dec 2004
    Posts
    25,618

    Re: Local Emailing Without an Email Client

    try this
    vb Code:
    1. Set objmessage = CreateObject("CDO.Message")
    2.       objmessage.Subject = "Example CDO Message"
    3.       objmessage.From = "[email protected]"
    4.       objmessage.To = "me" ' sent to myself, not at gmail
    5.       objmessage.TextBody = "This is some sample message text."
    6.        
    7.        objmessage.Configuration.Fields.Item _
    8.       ("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
    9.        
    10.       'Name or IP of Remote SMTP Server
    11.        
    12.        
    13.       'Type of authentication, NONE, Basic (Base64 encoded), NTLM
    14.       objmessage.Configuration.Fields.Item _
    15.       ("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = 1
    16.       'Your UserID on the SMTP server
    17.       objmessage.Configuration.Fields.Item _
    18.       ("http://schemas.microsoft.com/cdo/configuration/sendusername") = "usernm"
    19.        
    20.       'Your password on the SMTP server
    21.        
    22.       objmessage.Configuration.Fields.Item _
    23.       ("http://schemas.microsoft.com/cdo/configuration/sendpassword") = "pass"
    24.       objmessage.Configuration.Fields.Item _
    25.       ("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "smtp.mail.gmx.com"
    26.       'Server port (typically 25)
    27.       objmessage.Configuration.Fields.Item _
    28.       ("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 587
    29.       'Use SSL for the connection (False or True)
    30.       objmessage.Configuration.Fields.Item _
    31.       ("http://schemas.microsoft.com/cdo/configuration/smtpusessl") = false
    32.       'Connection Timeout in seconds (the maximum time CDO will try to establish a connection to the SMTP server)
    33.       objmessage.Configuration.Fields.Item _
    34.       ("http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout") = 30
    35.       objmessage.Configuration.Fields.Update
    36.       objmessage.Send
    37.       Set objmessage = Nothing
    if you are using your default smtp server and do not require username and password the code may be cut down to

    vb Code:
    1. Set objmessage = CreateObject("CDO.Message")
    2.       objmessage.Subject = "Example CDO Message"
    3.       objmessage.From = "[email protected]"
    4.       objmessage.To = "me" ' sent to myself, not at gmail
    5.       objmessage.TextBody = "This is some sample message text."
    6.       objmessage.Send
    7.       Set objmessage = Nothing
    i do my best to test code works before i post it, but sometimes am unable to do so for some reason, and usually say so if this is the case.
    Note code snippets posted are just that and do not include error handling that is required in real world applications, but avoid On Error Resume Next

    dim all variables as required as often i have done so elsewhere in my code but only posted the relevant part

    come back and mark your original post as resolved if your problem is fixed
    pete

  21. #21

    Thread Starter
    Fanatic Member
    Join Date
    Apr 2008
    Location
    Kent, England
    Posts
    713

    Re: Local Emailing Without an Email Client

    Deleted Post as it is no longer relevant.

    I have managed to rewrite the code as follows :

    Code:
     
    
    Public Sub SendEmail()
    Const cdoSendUsingPort = 2
    
    Const cdoBasic = 1
    
    Set objMessage = CreateObject("CDO.message")
    objMessage.Subject = "Example CDO Message"
    objMessage.From = "[email protected]"
    objMessage.To = "[email protected]"
    objMessage.TextBody = "test email"
    
    'SMTP Config
    
    objMessage.Configuration.Fields.Item _
    ("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
    
    'Name or IP of Remote SMTP Server
    objMessage.Configuration.Fields.Item _
    ("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "smtp.mail.yahoo.com"
    
    'Type of authentication, NONE, Basic, (Base64 Encoded), NTLM
    objMessage.Configuration.Fields.Item _
    ("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = cdoBasic
    
    'Your user ID on the SMTP Server
    objMessage.Configuration.Fields.Item _
    ("http://schemas.microsoft.com/cdo/configuration/sendusername") = "[email protected]"
    
    'Your password on the SMTP Server
    objMessage.Configuration.Fields.Item _
    ("http://schemas.microsoft.com/cdo/configuration/sendpassword") = "tmspassword"
    
    'Server Port, typically 25
    objMessage.Configuration.Fields.Item _
    ("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25
    
    'Use SSL for the connection?
    objMessage.Configuration.Fields.Item _
    ("http://schemas.microsoft.com/cdo/configuration/smtpusessl") = False
    
    'connection timeout
    objMessage.Configuration.Fields.Item _
    ("http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout") = 60
    
    objMessage.Configuration.Fields.Update
    
    objMessage.Send
    Set objMessage = Nothing
    MsgBox "Done"
    
    End Sub
    to be honest, I did find the layout off another site "www.paulsadowski.com/WHS/cdo.htm"
    Last edited by JayCR; Nov 4th, 2009 at 09:50 AM.
    "Wisdom is only truly achieved, when you realise you dont know everything" ... I must be a genius because I always have to ask stupid questions...

    Pointing an idiot like me in the right direction, is always appreciated by the idiot, explaining how to do what you have pointed the idiot to, is appreciated even more. I apologise to all experienced coders who will think I am an idiot, you are right, I am an idiot, but I am an idiot who is trying to learn

  22. #22

    Thread Starter
    Fanatic Member
    Join Date
    Apr 2008
    Location
    Kent, England
    Posts
    713

    Re: Local Emailing Without an Email Client

    OK, I dont know if this should or should not be a different thread, but it is from the same problem.

    allow me to refer to two seperate internet connections on my site, connection A and Connection B.

    Connection A works with the above code, problem free, I have also changed the port (as suggested per Yahoo's FAQ's see here now, Connection A allows me to use this application to send emails via ports 25 and 587.

    Connection B on the other hand, wont allow me to send emails via port 25, the port is blocked, most likely by the ISP, so as per advice, I tried to change the port to 587. I also ran a "shields up" check that allowed me to confirm that port 587 is not blocked, but open.

    on running the application (whilst trying to email via port 25 or 587!) the following error occurs.

    Code:
    Run-Time error '-2144220975 (80040213)':
    
    The message could not be sent to the SMTP server. The transport error code was 0x800ccc14. The Server Response was not available.
    Now the code has not changed between connections, (I am using virtual pc 2007, and just "swap" the connections to use wireless (connection A a seperate router) and Ethernet (connection B, on my local network, again a completely seperate router from connection A)

    What do we think? could this be a simple "ISP" problem, or is there any additional code I need to place in my app?

    J
    Last edited by JayCR; Nov 5th, 2009 at 09:06 AM. Reason: Couple of typo's, one being the run time error!
    "Wisdom is only truly achieved, when you realise you dont know everything" ... I must be a genius because I always have to ask stupid questions...

    Pointing an idiot like me in the right direction, is always appreciated by the idiot, explaining how to do what you have pointed the idiot to, is appreciated even more. I apologise to all experienced coders who will think I am an idiot, you are right, I am an idiot, but I am an idiot who is trying to learn

  23. #23
    PowerPoster
    Join Date
    Dec 2004
    Posts
    25,618

    Re: Local Emailing Without an Email Client

    if the isp has a smtp server, then try using their server on port 25

    if they did not have a smtp server they would not block port 25

    are you using the same yahoo account for both?
    i do my best to test code works before i post it, but sometimes am unable to do so for some reason, and usually say so if this is the case.
    Note code snippets posted are just that and do not include error handling that is required in real world applications, but avoid On Error Resume Next

    dim all variables as required as often i have done so elsewhere in my code but only posted the relevant part

    come back and mark your original post as resolved if your problem is fixed
    pete

  24. #24

    Thread Starter
    Fanatic Member
    Join Date
    Apr 2008
    Location
    Kent, England
    Posts
    713

    Re: Local Emailing Without an Email Client

    Yeah, the code doesnt change between the two, its literally I swap the internet accessing connection between connection A and B and the problem appears. Its the fact that it wont work on either port, but both ports are open!

    Its baffling me, I just cant find what is blocking it...
    "Wisdom is only truly achieved, when you realise you dont know everything" ... I must be a genius because I always have to ask stupid questions...

    Pointing an idiot like me in the right direction, is always appreciated by the idiot, explaining how to do what you have pointed the idiot to, is appreciated even more. I apologise to all experienced coders who will think I am an idiot, you are right, I am an idiot, but I am an idiot who is trying to learn

  25. #25
    PowerPoster
    Join Date
    Dec 2004
    Posts
    25,618

    Re: Local Emailing Without an Email Client

    just because the port is open on your computer does not mean it is open on the isp server
    did you try sending on the default smtp server?
    i do my best to test code works before i post it, but sometimes am unable to do so for some reason, and usually say so if this is the case.
    Note code snippets posted are just that and do not include error handling that is required in real world applications, but avoid On Error Resume Next

    dim all variables as required as often i have done so elsewhere in my code but only posted the relevant part

    come back and mark your original post as resolved if your problem is fixed
    pete

  26. #26

    Thread Starter
    Fanatic Member
    Join Date
    Apr 2008
    Location
    Kent, England
    Posts
    713

    Re: Local Emailing Without an Email Client

    not sure what you mean, but I did send it using all the default settings for SMTP on the connection A and B, it worked on A not on B, I also phoned the ISP and they told me they had no blockades in place, unles we specifically requested them, we never have.
    "Wisdom is only truly achieved, when you realise you dont know everything" ... I must be a genius because I always have to ask stupid questions...

    Pointing an idiot like me in the right direction, is always appreciated by the idiot, explaining how to do what you have pointed the idiot to, is appreciated even more. I apologise to all experienced coders who will think I am an idiot, you are right, I am an idiot, but I am an idiot who is trying to learn

  27. #27

    Thread Starter
    Fanatic Member
    Join Date
    Apr 2008
    Location
    Kent, England
    Posts
    713

    Re: Local Emailing Without an Email Client

    Well I have spoken to the ISP who have said that they do not block port 25, which leaves me to believe that it could be an app, but I am lost completely with it.
    "Wisdom is only truly achieved, when you realise you dont know everything" ... I must be a genius because I always have to ask stupid questions...

    Pointing an idiot like me in the right direction, is always appreciated by the idiot, explaining how to do what you have pointed the idiot to, is appreciated even more. I apologise to all experienced coders who will think I am an idiot, you are right, I am an idiot, but I am an idiot who is trying to learn

  28. #28
    PowerPoster
    Join Date
    Dec 2004
    Posts
    25,618

    Re: Local Emailing Without an Email Client

    try sending on port 27
    i have no idea if this will work, but i have just had a similar issue on a clients machine, and that worked for me, took a while to figure it though

    worked on port 25, with one connection, but not another, with same ISP
    i do my best to test code works before i post it, but sometimes am unable to do so for some reason, and usually say so if this is the case.
    Note code snippets posted are just that and do not include error handling that is required in real world applications, but avoid On Error Resume Next

    dim all variables as required as often i have done so elsewhere in my code but only posted the relevant part

    come back and mark your original post as resolved if your problem is fixed
    pete

  29. #29

    Thread Starter
    Fanatic Member
    Join Date
    Apr 2008
    Location
    Kent, England
    Posts
    713

    Re: Local Emailing Without an Email Client

    Thanks Westconn, unfortunately I have just tried that and it failed to connect to the server again...
    "Wisdom is only truly achieved, when you realise you dont know everything" ... I must be a genius because I always have to ask stupid questions...

    Pointing an idiot like me in the right direction, is always appreciated by the idiot, explaining how to do what you have pointed the idiot to, is appreciated even more. I apologise to all experienced coders who will think I am an idiot, you are right, I am an idiot, but I am an idiot who is trying to learn

  30. #30

    Thread Starter
    Fanatic Member
    Join Date
    Apr 2008
    Location
    Kent, England
    Posts
    713

    Re: Local Emailing Without an Email Client

    I Have just tried again, but this time bypassed the network, and plugged directly into the router, and it worked, so it seems there is our hardware firewall that is blocking the connection. Port 25 however is completely open, so is there anything else I need to configure on a firewall for this to work?

    to be honest it just works fine otherwise, but when I use the code to connect to the server, does traffic head straight to port 25 or does it hit anything else before hand??? i.e.

    Code:
    objMessage.Configuration.Fields.Item _
    ("http://schemas.microsoft.com/cdo/configuration/sendpassword") = "smtppassword"
    Does it travel via HTTP first before it tries to connect via port 25, as I cannot make this work, the port is open, but the app wont work!!

    Also does anyone know if it has a different "source port" and if so, is it different per machine?

    J
    Last edited by JayCR; Nov 23rd, 2009 at 06:05 AM.
    "Wisdom is only truly achieved, when you realise you dont know everything" ... I must be a genius because I always have to ask stupid questions...

    Pointing an idiot like me in the right direction, is always appreciated by the idiot, explaining how to do what you have pointed the idiot to, is appreciated even more. I apologise to all experienced coders who will think I am an idiot, you are right, I am an idiot, but I am an idiot who is trying to learn

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width