title: creating a vbs script function for sending email with attachment
body: <p>I'm new to scripting and I'm creating an automated task inside openoffice I'm having issue with the crude basic language but I found a excel macro written in vba that does what I need now im trying to convert this to a useable vbscript that can be executed from the command prompt with something like email.vbs mailto subject filetoattach</p>
  
  <pre><code>Dim cdoMsg As New CDO.Message
  
  With cdoMsg
      With .Configuration.Fields
          .Item(cdoSendUsingMethod).Value = cdoSendUsingPort
          .Item(cdoSMTPUseSSL).Value = True
          .Item(cdoSMTPServerPort).Value = 465
          .Item(cdoSMTPServer).Value = "smtpserver"
          .Item(cdoSendUserName).Value = "wolverinewest@wolverinetruckgroup.com"
          .Item(cdoSendPassword).Value = "mypass"
          .Item(cdoSMTPAuthenticate).Value = cdoBasic
          .Update
      End With
      .From = "myemail"
      .To = "emailto"
      .Subject = "Some more really spiffy mail for you!"
      .TextBody = "please find attachment"
      .AddAttachment App.Path &amp; "attachment"
  
      On Error Resume Next
      .Send
  End With
  
  If Err.Number &lt;&gt; 0 Then
      MsgBox "CDO error " &amp; Hex$(Err.Number) &amp; vbNewLine &amp; Err.Description, _
             vbOKOnly Or vbExclamation, _
             Caption
  Else
      MsgBox "Mail sent!", vbOKOnly, Caption
  End If
  </code></pre>