Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

mailto: with attachments?

1,670 views
Skip to first unread message

Richard Ouellette

unread,
Nov 8, 2002, 6:09:59 PM11/8/02
to
Hi
I did a search of the news groups and could not find out how to add an
attachment file to this function that I believe came from Ken. Can you
offer some guidance? Also if you know how to add "Body" and "CC & BCC" it
would be helpful.
Thanks
Rick

Function MailOutFile
local rrw,outfile,cAddr
rrw = form.rrwrunindatamodule1.rrwrunin1.rowset
outfile = rrw.fields["ri_outfile"].value
cAddr = "mailto:joh...@dohndoeland.com?subject=Reports"
ShellExecute(form.hwnd, 'open',cAddr, '', '', 1)
return


Ken Mayer [dBASE, Inc.]

unread,
Nov 8, 2002, 6:15:31 PM11/8/02
to
"Richard Ouellette" <rouel...@mandecsys.com> wrote:

>I did a search of the news groups and could not find out how to add an
>attachment file to this function that I believe came from Ken. Can you
>offer some guidance? Also if you know how to add "Body" and "CC & BCC" it
>would be helpful.

Not me. If you're going to deal with attachments I think you've got
more work ahead of you.

Ken
---
Ken Mayer [dBASE, Inc.]
** Please respond ONLY in the newsgroups **

"Think OOP"

dBASE, Inc. website: http://www.dbase.com

Jan Hoelterling

unread,
Nov 8, 2002, 10:01:08 PM11/8/02
to
Richard,

mailto does not support attachents. Unforetunately, nothing you can do
(believe me, I've tried!). I have created an "email.cc" for the different
methods of email I support, the code for "mailto" is below. I did not write
this code (for the most part) and I can't remember who did, do I apologize
that I'm not giving proper credit for this. Please note that the message
text, including spaces and line breaks, first needs to be converted to
"web-safe" characters. In the code, "this.text" refers to the message body.
I'm sure you can figure out the others...

Hope this helps,

Jan

#define SW_SHOWNORMAL 1
#define WINAPI_SHELL "SHELL32"
#define WINAPI_A "A"
#define WINAPI_SHELL "SHELL32"

if type( "ShellExecute" ) # "FP"
extern cHandle ShellExecute( cHandle, cString, cString, ;
cString, cString, cINT ) WINAPI_SHELL ;
from "ShellExecute"+WINAPI_A
endif
mailtotext=""
for i=1 to len(this.text)
h1=subst(this.text,i,1)
if asc(h1)=32
h1="%20"
endif
if asc(h1)=13
h1="%0d"
endif
if asc(h1)=10
h1="%0a"
endif
mailtotext=mailtotext+h1
next i
mailstr = 'mailto:'+this.to+' ?Subject='+this.subject+'
&Body='+mailtotext
if len(trim(this.cc))>0
mailstr=mailstr+" &CC="+this.cc
endif
if len(trim(this.bcc))>0
mailstr=mailstr+" &BCC="+this.bcc
endif
*msgbox(mailstr)
ShellExecute(0, "open", mailstr, null, null, SW_SHOWNORMAL)
if this.attachments.size>0
msgbox("This email method does not support
attachments."+chr(13)+;
"Your attachment(s) were not transferred, you
will"+chr(13)+;
"need to add them manually.","Warning",48)
endif


Romain Strieff [dBVIPS]

unread,
Nov 9, 2002, 7:45:05 AM11/9/02
to
In article Jan Hoelterling, jhoelterling@compu_ns_serve..com politely
paraphrased...

> mailto does not support attachents. Unforetunately, nothing you can do
> (believe me, I've tried!).
>
Since attachments are just encoded text, did you try to encode it
yourself and just add it to the message body string?

------=_NextPart_000_00C4_01C27951.245928D0
Content-Type: application/pdf;
name="ANFAHRT.PDF"
Content-Disposition: attachment;
filename="ANFAHRT.PDF"
Content-Transfer-Encoding: base64

JVBERi0xLjMNJeLjz9MNCjE1IDAgb2JqDTw8IA0vTGluZWFyaXplZCAxIA0vTyAxNyANL0gg
WyAx
MDUyIDIwNyBdIA0vTCAzNzMxOSANL0UgMzYwMzYgDS9OIDEgDS9UIDM2OTAxIA0
+PiANZW5kb2Jq

...<middle part stripped>

ZuCkZBpPevAg9Cke0llvoQKTv0maU8Kb4pGno+KXsEekPEOomal8B1qXqMKlZ8l6E/Oojimb
22GQ
xVKp2MagmPpqQQAAOw==

------=_NextPart_000_00C4_01C27951.245928D0--

--
Romain Strieff [dBVIPS]
http://www.dbase.com/Docs/newsguid.htm

Jan Hoelterling

unread,
Nov 9, 2002, 9:19:19 AM11/9/02
to
hmmm, noooooo?

I see what you are saying. This might be a possibility, but I am not sure if
it wouldn't be a little too much work... How did you get the stuff below?
What would I need to do to encode the file like below?

Thanks,

Jan


"Romain Strieff [dBVIPS]" <Rom...@forget.it> wrote in message
news:MPG.1837215e5...@news.dbase.com...


> >
> Since attachments are just encoded text, did you try to encode it
> yourself and just add it to the message body string?
>
>
>
> ------=_NextPart_000_00C4_01C27951.245928D0
> Content-Type: application/pdf;
> name="ANFAHRT.PDF"
> Content-Disposition: attachment;
> filename="ANFAHRT.PDF"
> Content-Transfer-Encoding: base64
>
> JVBERi0xLjMNJeLjz9MNCjE1IDAgb2JqDTw8IA0vTGluZWFyaXplZCAxIA0vTyAxNyANL0gg
>

> ------=_NextPart_000_00C4_01C27951.245928D0--
>

Ronald de Vries

unread,
Nov 9, 2002, 9:46:32 AM11/9/02
to
Hi Richard,
If I good understand your question:
You will send an attachment with an email?
I do not want to go in detail for the code here but I use
the email of Jean-Pierre Martel and I can send attachments.
Look for this in the dBulletin.
I hope this was an answer to your question
(Your question belongs in the NG dbase.dde-ole-dll-winapi)

cu

Ronald

"Richard Ouellette" <rouel...@mandecsys.com> wrote in message
news:aqhg89$ifg$1...@news.dbase.com...

Romain Strieff [dBVIPS]

unread,
Nov 9, 2002, 11:32:48 AM11/9/02
to
In article Jan Hoelterling, jhoelterling@compu_ns_serve..com politely
paraphrased...
>
> I see what you are saying. This might be a possibility, but I am not sure if
> it wouldn't be a little too much work... How did you get the stuff below?
> What would I need to do to encode the file like below?
>
http://www.fpx.de/fp/Software/UUDeview/

Sylvain Lavoie

unread,
Nov 9, 2002, 12:56:55 PM11/9/02
to
Hi,

For this kind of work, I use ASPMAIL http://www.aspemail.com/index.html.

Exemple:

local oEmail
try
oEmail=new email()
catch (exception e)
RunHidden( "regsvr32 /s d:\AspEmail.dll" )
RunHidden( "regsvr32 /s d:\AspUpLoad.dll" )
sleep 5
try
oEmail=new email()
catch (exception e)
msgbox(e.message, "Error Code "+ltrim(str(e.code)))
cretour = false
endtry
endtry
oEmail.IsHTML = true \\ if your message is in HTML
oEmail.body = ReadFile(form.EFFILEHTML.Value,65535)
oEmail.host = form.Host.Value
oEmail.from = form.FROM.Value
oEmail.FromName = oEmail.EncodeHeader(form.FromName.Value)
oEmail.subject = oEmail.EncodeHeader(form.EFSUBJECT.Value)
oEmail.AddAddress(form.EFTO.Value)
if not empty(form.EFATTACHE.value)
// loop if ou have more than 1 attachement
for i = 1 to NumberWords(form.EFATTACHE.value,",")
temp = GetWord(form.EFATTACHE.value,",",i)
if not empty(temp)
oEmail.AddAttachment(temp)
endif
next
endif
if empty(form.EFCC.value) = false
oEmail.AddCC(form.EFCC.value)
endif
try
oEmail.send()
catch (exception e)
msgbox(e.message, "Error Code "+ltrim(str(e.code)))
endtry
oEmail.reset()
release object oEmail

class email of oleautoclient("persits.mailsender") custom // do not change
this.host:="smtp.xxxxx.com" // put your ISP's Mail Server name
this.from := "al...@xxxx.com" // put your e-mail address
this.FromName := "someone" // put your real name
this.subject := "Nothing." // default subject
this.body := "Nothing." // default body text
this.IsHTML = False
endclass

Bye

Sylvain Lavoie


Richard Ouellette

unread,
Nov 9, 2002, 6:01:07 PM11/9/02
to
Jan
This feedback was very helpful and the code answered several of my questions
and provided a potential work-around. I also noticed that Romain has
provided some input as well... perhaps Marko will also jump in.
Thanks
Rick

Richard Ouellette

unread,
Nov 9, 2002, 6:00:12 PM11/9/02
to
Ronald & Sylvain
Thanks for your suggestion about using ASPMAIL. I am currently using this
(many thanks to Jean-Pierre's article) for the automated mailing of reports
with known email addresses. I was hoping to hit a home run with the
:mailtro option where the end user could select the file for emailing and
have it automatically attached & launch Outlook. The end-user would only
have to select the recipient from within Outlook and perhaps add a note to
the body..
Unfortunately for ASPMAIL, it will hang if there is no connection to the
internet. Version 4.5 has an agent for queuing when there is no connection
but I am not sure this is the best approach.
Thank Again
Rick

Jan Hoelterling

unread,
Nov 11, 2002, 4:27:24 PM11/11/02
to
You're welcome.

Jan

"Richard Ouellette" <rouel...@mandecsys.com> wrote in message

news:aqo6te$ago$2...@news.dbase.com...

Marko Mihorko [dBVIPS]

unread,
Nov 12, 2002, 4:36:26 PM11/12/02
to
Hello Richard!

"Richard Ouellette" je napisal v sporočilo...

> I also noticed that Romain has
> provided some input as well... perhaps Marko will also jump in.

Sorry, no time to spare at the moment, so this time I am jumping only _over_
this thread. <g>

Marko Mihorko [dBVIPS]

Presernova druzba d.d.
dBASE, Inc. International Partner
http://www.prdr.com/dbase


Jan Hoelterling

unread,
Nov 13, 2002, 3:51:29 PM11/13/02
to
How did you look at the "encoded" part of the message? I would like to make
a little test message with a simple file, like and Icon or a small text file
and would like to see what that would look like in my mail program. But, my
mail program(s) are too smart and only show me the "cleansed" view rather
than the stuff below?

Thanks,

Jan

"Romain Strieff [dBVIPS]" <Rom...@forget.it> wrote in message
news:MPG.1837215e5...@news.dbase.com...

Romain Strieff [dBVIPS]

unread,
Nov 14, 2002, 12:39:04 AM11/14/02
to
In article Jan Hoelterling, jhoelterling@compu_ns_serve..com politely
paraphrased...
> How did you look at the "encoded" part of the message? I would like to make
> a little test message with a simple file, like and Icon or a small text file
> and would like to see what that would look like in my mail program. But, my
> mail program(s) are too smart and only show me the "cleansed" view rather
> than the stuff below?
>
right click emailŚPROPERTIESŚDETAILSŚMESSAGE SOURCE

Jan Hoelterling

unread,
Nov 14, 2002, 10:01:13 AM11/14/02
to
Which email program were you using? I am currently stuck with Outlook
Express, and this doesn't seem to work...

Thanks,

Jan

"Romain Strieff [dBVIPS]" <Rom...@forget.it> wrote in message

news:MPG.183d4739e...@news.dbase.com...

Romain Strieff [dBVIPS]

unread,
Nov 14, 2002, 3:10:24 PM11/14/02
to
In article Jan Hoelterling, jhoelterling@compu_ns_serve..com politely
paraphrased...
> Which email program were you using? I am currently stuck with Outlook
> Express, and this doesn't seem to work...
>
That's what I use.
0 new messages