Page 1 of 1 1
Topic Options
#169711 - 2006-10-20 02:27 PM Sending e-mail with attachment using Blat
Mart Moderator Offline
KiX Supporter
*****

Registered: 2002-03-27
Posts: 4673
Loc: The Netherlands
Guy's,

Been using Blat for some time now to send e-mail messages from several scripts. I attach a txt file (logs) with almost every mail. These txt files are between 1 and 20KB. This all works fine.

The problem.
We have a new project that requires sending an e-mail message with a jpg file attached. I thought why not use Blat for this and attach the jpg file.
The message gets send as it should but each jpg file is corrupted after sending. The jpg files are between 50KB and +/- 4MB. All jpg files get screwed up even the "little" ones. Windows says that the file is only 300 bytes. When sending a 250KB txt file all is ok. Just not with the jpg images. I also tried gif images but that gave the same results.

Been searching the net but did not find anything about this.
Anyone have any idea what might be causing this?
_________________________
Mart

- Chuck Norris once sold ebay to ebay on ebay.

Top
#169712 - 2006-10-20 02:58 PM Re: Sending e-mail with attachment using Blat
Mart Moderator Offline
KiX Supporter
*****

Registered: 2002-03-27
Posts: 4673
Loc: The Netherlands
hmmmm...

This works. It is depending on outlook being installed and configured. It also shows a warning that something or someone is trying to access outlook. Have to find a way to disable that. Not pretty but it works.

Taken from the FAQ.

Code:

$Root = CreateObject("Outlook.Application")
$MailItem = $Root.CreateItem(0)
;0 = low importance, 1 = normal importance, 2 = high importance.
$MailItem.Importance = 1
$MailItem.Subject = "Automation Test"
$MailItem.To = "to@@domain.nl"
$MailItem.Body = "Test"
If Exist("d:\test\23506.jpg")
$MailItem.Attachments.Add("d:\test\23506.jpg")
EndIf
$MailItem.Send
$Root = 0




[edit]
Looks like I can’t specify a from address.
Now it sends on behalf of the logged on account.
So it does not work as I want it to.
[/edit]


Edited by Mart (2006-10-20 03:02 PM)
_________________________
Mart

- Chuck Norris once sold ebay to ebay on ebay.

Top
#169713 - 2006-10-20 03:22 PM Re: Sending e-mail with attachment using Blat
Kdyer Offline
KiX Supporter
*****

Registered: 2001-01-03
Posts: 6241
Loc: Tigard, OR
So.. Does this help?
http://www.kixtart.org/ubbthreads/showflat.php?Cat=0&Number=81626&an=0&page=1#81626

Look at the Outlook Section..

Kent

Top
#169714 - 2006-10-20 03:30 PM Re: Sending e-mail with attachment using Blat
Mart Moderator Offline
KiX Supporter
*****

Registered: 2002-03-27
Posts: 4673
Loc: The Netherlands
That's the exact script I used (changed the e-mail addies and attachment name). I don't see how to add a sender address. Disabling the security warning also needs to be done but that might be something that can be done by a GPO setting or something.
_________________________
Mart

- Chuck Norris once sold ebay to ebay on ebay.

Top
#169715 - 2006-10-20 03:47 PM Re: Sending e-mail with attachment using Blat
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
There was a recent post on the exact same topic. Search is your friend.
Top
#169716 - 2006-10-20 04:35 PM Re: Sending e-mail with attachment using Blat
Mart Moderator Offline
KiX Supporter
*****

Registered: 2002-03-27
Posts: 4673
Loc: The Netherlands
Damn. It was just a matter of removing one character.

For attaching file I use the –attacht option. -attach is also an option and that send the images as it should.
_________________________
Mart

- Chuck Norris once sold ebay to ebay on ebay.

Top
#169717 - 2006-10-20 04:43 PM Re: Sending e-mail with attachment using Blat
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
Doh! Don't you feel silly?
Borrowing from the manual:
Quote:

----------------------- Attachment and encoding options -----------------------
-attach <file> : attach binary file(s) to message (comma separated)
-attacht <file> : attach text file(s) to message (comma separated)
-embed <file> : embed file(s) in HTML. Object tag in HTML must specify
content-id using cid: tag. eg: <img src="cid:image.jpg">
-af <file> : file containing list of binary file(s) to attach (comma
separated)
-atf <file> : file containing list of text file(s) to attach (comma
separated)
-aef <file> : file containing list of embed file(s) to attach (comma
separated)
-base64 : send binary files using base64 (binary MIME)
-uuencode : send binary files UUEncoded
-enriched : send an enriched text message (Content-Type=text/enriched)
-html : send an HTML message (Content-Type=text/html)
-alttext <text> : plain text for use as alternate text
-alttextf <file>: plain text file for use as alternate text
-mime : MIME Quoted-Printable Content-Transfer-Encoding
-8bitmime : ask for 8bit data support when sending MIME
-multipart <size>
: send multipart messages, breaking attachments on <size>
KB boundaries, where <size> is per 1000 bytes




Top
#169718 - 2006-10-20 04:54 PM Re: Sending e-mail with attachment using Blat
Mart Moderator Offline
KiX Supporter
*****

Registered: 2002-03-27
Posts: 4673
Loc: The Netherlands
Quote:

Doh! Don't you feel silly?
Borrowing from the manual:
....





Just a little
RTFM is not my best habit
_________________________
Mart

- Chuck Norris once sold ebay to ebay on ebay.

Top
#169719 - 2006-10-20 05:19 PM Re: Sending e-mail with attachment using Blat
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
Ja, seems the manual is often the last place to look.

(maybe because the answer is there so there is no need to look further :/)

Top
Page 1 of 1 1


Moderator:  Arend_, Allen, Jochen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Mart 
Hop to:
Shout Box

Who's Online
0 registered and 857 anonymous users online.
Newest Members
JimDunn, fgarcia, Viginette, ManuvdWielNL, Sir_Barrington
17890 Registered Users

Generated in 0.056 seconds in which 0.023 seconds were spent on a total of 12 queries. Zlib compression enabled.

Search the board with:
superb Board Search
or try with google:
Google
Web kixtart.org