VB Send Mail using Thunderbird

  • Thread starter Thread starter Vacuum Sealed
  • Start date Start date
V

Vacuum Sealed

Hi guy's

As I have upgraded my home system to Win7 and Off2010 (minus Outlook), I
have been using Thunderbird.

I quite easily used the MS suite to do everything nicely, but now have
to urgently get the Thunderbird equivalent up and running as I will be
working from home on Thursday.

I tried this and it compiles and runs through, it just does not kick off
TB or the message.

Unfortunately, I can't use C.D.O. due to the formatting of information
in the message body.

Really appreciate a point in the right direction please..

Sub sendEmail(emailaddr As String, eVendorsName As String, cLoad As
String, cPO As String, cStacks As String, cDC As String, cDay As String,
cDat As String, CTime As String, CPAL As String, LPAL As String)

Dim vTBird As String, vInLine As String, vSubject As String, strbody As
String

vTBird = "C:\Program Files(86)\Mozilla Thunderbird\Thunderbird.exe"

vSubject = "Pick-Ups for " & cDat & " - " & "Collecting Load ID: " & cLoad

strbody = "HI, " & Chr(10) & _
"" & Chr(10) & _
"We will be calling in to pick up (On Behalf of) the following
Order(s) :" & Chr(10) & _
"" & Chr(10) & _
"Vendor : " & eVendorsName & Chr(10) & _
"" & Chr(10) & _
"Load ID : " & cLoad & Chr(10) & _
"PO No(s) : " & cPO & Chr(10) & _
"Pallet Stack(s) : " & cStacks & Chr(10) & _
"Bound For : " & cDC & Chr(10) & _
"" & Chr(10) & _
"Day : " & cDay & Chr(10) & _
"Date : " & cDat & Chr(10) & _
"Time : " & CTime & " Approx" & Chr(10) & _
"" & Chr(10) & _
"" & Chr(10) & _
"Pallet Exchange Details: Chep = " & CPAL & " - Loscam = " & LPAL
& Chr(10) & _
"" & Chr(10) & _
"Regards, " & Chr(10) & _
"Transport"

On Error Resume Next

vInLine = " -compose to=" & emailaddr _
& ",subject=" & vSubject _
& ",body=" & strbody

Call Shell(vTBird & vInLine, vbMaximizedFocus)

On Error GoTo 0

Exit Sub
End Sub



As always thank you heaps..
Mick.
 
Mick, I normally construct the mailto, subject, body and add any
attachments, then invoke the default mail app via ShellExecute. This
opens the new message in a standard message window ready for editing by
the user (if needed) before final send. It works with whatever is your
default mail client. On my Win7 machine it's Tbird. On my dev machine
it can be OE or Tbird if I choose because I use both for testing and so
often switch them around. I don't use Outlook at all and so I can't
speak to that.

--
Garry

Free usenet access at http://www.eternal-september.org
ClassicVB Users Regroup!
comp.lang.basic.visual.misc
microsoft.public.vb.general.discussion
 
Mick, I normally construct the mailto, subject, body and add any
attachments, then invoke the default mail app via ShellExecute. This
opens the new message in a standard message window ready for editing by
the user (if needed) before final send. It works with whatever is your
default mail client. On my Win7 machine it's Tbird. On my dev machine it
can be OE or Tbird if I choose because I use both for testing and so
often switch them around. I don't use Outlook at all and so I can't
speak to that.

Hi Garry

I got Thunderbird to fire with a new message and the recipient, and the
subject, but could not get the strBody to display.

I even went so far as to try C.D.O. which was a total waste of time as I
don't get to see the message at all prior to sending, not to mention, I
couldn't get it to work anyway.

I would be most interested to see what your code looks like, I may be
able to adapt it for what I need, at least until I can save up and pay
for MS Outlook.

Cheers
Mick.
 
Vacuum Sealed explained :
Hi Garry

I got Thunderbird to fire with a new message and the recipient, and the
subject, but could not get the strBody to display.

I even went so far as to try C.D.O. which was a total waste of time as I
don't get to see the message at all prior to sending, not to mention, I
couldn't get it to work anyway.

I would be most interested to see what your code looks like, I may be able to
adapt it for what I need, at least until I can save up and pay for MS
Outlook.

Cheers
Mick.

I'll see what I can find for code samples, but all my stuff is adapted
from Ron DeBrun's examples. As for MS Outlook.., don't bother!

--
Garry

Free usenet access at http://www.eternal-september.org
ClassicVB Users Regroup!
comp.lang.basic.visual.misc
microsoft.public.vb.general.discussion
 
I just seem to have an issue with getting the message body to show, I
seem to be only able to get the 1st line and that's it.
 
It happens that Vacuum Sealed formulated :
I just seem to have an issue with getting the message body to show, I seem to
be only able to get the 1st line and that's it.

Turns out I went with using a VB wrapper "vbSendMail.dll" because it
was reliable and easy. The attachment was the active workbook and I
used xlDialogSendMail which just opened with the recipient address,
subject, and workbook attached.

Another example I looked at used SendKeys with OE to enter message
body. The syntax for CarriageReturns/LineFeeds isn't standard VB syntax
and so is why you don't get anything past the 1st line. I had a sample
at one time but can't seem to find it just now. I'll keep looking but
I'm sure you can google and find it easily enough online.

--
Garry

Free usenet access at http://www.eternal-september.org
ClassicVB Users Regroup!
comp.lang.basic.visual.misc
microsoft.public.vb.general.discussion
 
Back
Top