Very Hot Topic (More than 25 Replies) [Solved] @ASynchShell file insert? (Read 3389 times)
tcgeo
Full Member
***
Offline



Posts: 278
Location: Traverse City, Michigan
Joined: May 13th, 2008
[Solved] @ASynchShell file insert?
Nov 25th, 2008 at 4:16pm
Print Post Print Post  
I can open Outlook, insert an email address and fill in the subject area using:  

@ASynchShell("mailto: emailaddress?subject=Have a Happy Turkey Day everybody?")

Is it possible to also insert a file at the same time?

And while we’re at it, is it also possible to fill in the body of the message with the file contents?

I was able to insert a file using CreateAProcess but not the subject or address at the same time.

I would prefer to use @ASynchShell.

Thanks
« Last Edit: Nov 28th, 2008 at 1:54am by Hammer »  
Back to top
IP Logged
 
Bob_Hansen
Senior Member
Members
*****
Offline


WOW, They have the Internet
on computers now!

Posts: 1861
Location: Salem, NH
Joined: Nov 24th, 2002
Re: @ASynchShell file insert?
Reply #1 - Nov 25th, 2008 at 5:58pm
Print Post Print Post  
There are some old examples on the forum with more details.  Search for Outlook.

But here are some quick lines from some old notes I had handy:

Quote:
vEmail = "myname@myplace.com"
vRe = "This is a test of the Subject line"
vPath = @CHR(34) + "C:\Program Files\Microsoft Office\Office\OUTLOOK.EXE" + @CHR(34)
n = @Shell(vPath + " /c ipm.note /m mailto:" + vEmail + "?Subject=" + vRe)

Outlook command line switches are here: http://www.outlook-tips.net/howto/commandlines.htm but do not seem to include switches for body.  And just a reminder, Outlook is not the same as Outlook Express which has a different syntax.
« Last Edit: Nov 25th, 2008 at 7:57pm by Bob_Hansen »  



Bob Hansen
Sesame Database Manager Professional
Sensible Solutions Inc.
Salem, NH
603-898-8223
Skype ID = sensiblesolutions
Back to top
IP Logged
 
Hammer
YaBB Administrator
Lanticans
*****
Offline


Fire bad. Tree pretty.

Posts: 3436
Location: Ohio
Joined: Nov 22nd, 2002
Re: @ASynchShell file insert?
Reply #2 - Nov 25th, 2008 at 6:48pm
Print Post Print Post  
The webpage in the link includes a /a switch that appears to allow a file attachment. Also, it appears that &body might get you the message body. Something like:
@ASynchShell("mailto: emailaddress?subject=Have a Happy Turkey Day everybody&body=bodytext")


BTW, Would the built-in @SendMail command work for you?
  

- Hammer
The plural of anecdote is not data.
Back to top
IP Logged
 
tcgeo
Full Member
***
Offline



Posts: 278
Location: Traverse City, Michigan
Joined: May 13th, 2008
Re: @ASynchShell file insert?
Reply #3 - Nov 25th, 2008 at 7:08pm
Print Post Print Post  
Thanks for the responses Bob & Erica.

I was secretly hoping that you might come up with a word just like “subject=” that I hadn’t tried yet, like attachment=, file=, etc. I knew I couldn’t get that lucky!

I’ll give your suggestions a try.

Thank you.
  
Back to top
IP Logged
 
Bob_Hansen
Senior Member
Members
*****
Offline


WOW, They have the Internet
on computers now!

Posts: 1861
Location: Salem, NH
Joined: Nov 24th, 2002
Re: @ASynchShell file insert?
Reply #4 - Nov 25th, 2008 at 7:27pm
Print Post Print Post  
I guess that I should have looked at the current web page.  That reference, as I noted, was from some OLD notes.  I had a printout of that page and /a was not included.  I don't know if /a is an addition or if my original was in error.

Where do you see the reference to "&body=" ?  I know that is good for Thunderbird but can't find that for Outlook.

In any case, thanks for the update Erika.  I have made a new printout that includes the "/a".
  



Bob Hansen
Sesame Database Manager Professional
Sensible Solutions Inc.
Salem, NH
603-898-8223
Skype ID = sensiblesolutions
Back to top
IP Logged
 
Hammer
YaBB Administrator
Lanticans
*****
Offline


Fire bad. Tree pretty.

Posts: 3436
Location: Ohio
Joined: Nov 22nd, 2002
Re: @ASynchShell file insert?
Reply #5 - Nov 25th, 2008 at 7:30pm
Print Post Print Post  
Bob_Hansen wrote on Nov 25th, 2008 at 7:27pm:
Where do you see the reference to "&body=" ?  I know that is good for Thunderbird but can't find that for Outlook.


No one place. I saw it go by in several places as I looked around. I don't want to install Outlook, so I can't really test this, unfortunately...
  

- Hammer
The plural of anecdote is not data.
Back to top
IP Logged
 
tcgeo
Full Member
***
Offline



Posts: 278
Location: Traverse City, Michigan
Joined: May 13th, 2008
Re: @ASynchShell file insert?
Reply #6 - Nov 25th, 2008 at 8:20pm
Print Post Print Post  
&body= does place whatever follows the = sign into the message portion of the email. Now, what’s the trick to getting it to enter text or jpg content from a variable? In other words I can't get &body= to place a files contents into the message area, only whatever is typed after the = sign shows up.

The a/ switch only seems to work when using CreateAProcess. I didn't have any luck when trying it with @shell.
  
Back to top
IP Logged
 
Hammer
YaBB Administrator
Lanticans
*****
Offline


Fire bad. Tree pretty.

Posts: 3436
Location: Ohio
Joined: Nov 22nd, 2002
Re: @ASynchShell file insert?
Reply #7 - Nov 25th, 2008 at 8:38pm
Print Post Print Post  
tcgeo wrote on Nov 25th, 2008 at 8:20pm:
&body= does place whatever follows the = sign into the message portion of the email. Now, what’s the trick to getting it to enter text or jpg content from a variable? In other words I can't get &body= to place a files contents into the message area, only whatever is typed after the = sign shows up.

The a/ switch only seems to work when using CreateAProcess. I didn't have any luck when trying it with @shell.


I know it won't just stuff a jpg in there. Binary content would have to be an attachment. For text, try reading the file contents into a variable using @Insert, then passing in the variable.

var vMsg as String

    vMsg = @Insert("myfile.txt")
    ...whatever... "&body=" + vMsg
  

- Hammer
The plural of anecdote is not data.
Back to top
IP Logged
 
tcgeo
Full Member
***
Offline



Posts: 278
Location: Traverse City, Michigan
Joined: May 13th, 2008
Re: @ASynchShell file insert?
Reply #8 - Nov 25th, 2008 at 9:46pm
Print Post Print Post  
Thanks for the suggestion.

I can't get it to accept the + vMsg part. I'll keep pounding on it.

Thanks again.
  
Back to top
IP Logged
 
Hammer
YaBB Administrator
Lanticans
*****
Offline


Fire bad. Tree pretty.

Posts: 3436
Location: Ohio
Joined: Nov 22nd, 2002
Re: @ASynchShell file insert?
Reply #9 - Nov 25th, 2008 at 10:28pm
Print Post Print Post  
tcgeo wrote on Nov 25th, 2008 at 9:46pm:
Thanks for the suggestion.

I can't get it to accept the + vMsg part. I'll keep pounding on it.

Thanks again.


You have to get it in the right place. You're assembling the text as if you'd typed it. Of course, if the text has carriage returns or is very long, it will break the command line.

Again, is there a reason why you are not using @SendMail? It does all this stuff.
  

- Hammer
The plural of anecdote is not data.
Back to top
IP Logged
 
tcgeo
Full Member
***
Offline



Posts: 278
Location: Traverse City, Michigan
Joined: May 13th, 2008
Re: @ASynchShell file insert?
Reply #10 - Nov 25th, 2008 at 10:35pm
Print Post Print Post  
Only that it looks pretty daunting, but I'm going to work on it.

Thanks.
  
Back to top
IP Logged
 
Hammer
YaBB Administrator
Lanticans
*****
Offline


Fire bad. Tree pretty.

Posts: 3436
Location: Ohio
Joined: Nov 22nd, 2002
Re: @ASynchShell file insert?
Reply #11 - Nov 25th, 2008 at 11:58pm
Print Post Print Post  
tcgeo wrote on Nov 25th, 2008 at 10:35pm:
Only that it looks pretty daunting, but I'm going to work on it.

Thanks.


Believe me that it's a boatload easier than automating Outlook. Get in touch with Support tomorrow if you need more examples.
  

- Hammer
The plural of anecdote is not data.
Back to top
IP Logged
 
tcgeo
Full Member
***
Offline



Posts: 278
Location: Traverse City, Michigan
Joined: May 13th, 2008
Re: @ASynchShell file insert?
Reply #12 - Nov 26th, 2008 at 1:38pm
Print Post Print Post  
Ok Erica, @SendMail is not that daunting, it works well!

Thanks for bringing it to my attention.

Have a great holiday!
  
Back to top
IP Logged
 
Hammer
YaBB Administrator
Lanticans
*****
Offline


Fire bad. Tree pretty.

Posts: 3436
Location: Ohio
Joined: Nov 22nd, 2002
Re: @ASynchShell file insert?
Reply #13 - Nov 26th, 2008 at 1:45pm
Print Post Print Post  
tcgeo wrote on Nov 26th, 2008 at 1:38pm:
Ok Erica, @SendMail is not that daunting, it works well!

Thanks for bringing it to my attention.

Have a great holiday!


You're welcome. I'm glad you are undaunted!  Smiley
  

- Hammer
The plural of anecdote is not data.
Back to top
IP Logged
 
tcgeo
Full Member
***
Offline



Posts: 278
Location: Traverse City, Michigan
Joined: May 13th, 2008
Re: @ASynchShell file insert?
Reply #14 - Nov 26th, 2008 at 3:03pm
Print Post Print Post  
Maybe a little more help on this?

When I enter a complete path into the @SendMail code to attach a jpg, the email works great. If I use a variable and place it in the same location, the email never gets received. I don’t know if it gets sent.

For example, this works:

……."writer@NotReallyAServer.com, "", "Hey guys, how are you?", "", "", "C:\my.jpg")

This does not work:

……."writer@NotReallyAServer.com, "", "Hey guys, how are you?", "", "", vPath)

While playing around with it, I added this:  ,""  to the code so that it looks like this:

……."writer@NotReallyAServer.com, "", "Hey guys, how are you?", "", "", "", vPath)

With this I receive two emails, one with the attachment and one without. The one with the attachment has the attachment scaled down in size to about 20% of the original and cannot be opened.

Any ideas on how to get it to accept the variable?

Thanks.
  
Back to top
IP Logged
 
Hammer
YaBB Administrator
Lanticans
*****
Offline


Fire bad. Tree pretty.

Posts: 3436
Location: Ohio
Joined: Nov 22nd, 2002
Re: @ASynchShell file insert?
Reply #15 - Nov 26th, 2008 at 3:22pm
Print Post Print Post  
Can we please see the entirety of the @Sendmail line? You can obfuscate the actual addresses, login and password, but we need to see all the arguments.
  

- Hammer
The plural of anecdote is not data.
Back to top
IP Logged
 
tcgeo
Full Member
***
Offline



Posts: 278
Location: Traverse City, Michigan
Joined: May 13th, 2008
Re: @ASynchShell file insert?
Reply #16 - Nov 26th, 2008 at 4:00pm
Print Post Print Post  

Works:

@SendMail("smtp.charter.net","My Sesame Test email", "From@charter.net","To@charter.net","",""," My message ", "", "", "C:\My.jpg")

Doesn’t  work:

vPath = “C:\My.jpg”

@SendMail("smtp.charter.net","My Sesame Test email", "From@charter.net","To@charter.net","","","My message", "", "",vPath)


Sends two emails and scales down .jpg.

vPath = “C:\My.jpg”

@SendMail("smtp.charter.net","My Sesame Test email", "From@charter.net","To@charter.net","","","My message", "", "", "", vPath)


  
Back to top
IP Logged
 
Hammer
YaBB Administrator
Lanticans
*****
Offline


Fire bad. Tree pretty.

Posts: 3436
Location: Ohio
Joined: Nov 22nd, 2002
Re: @ASynchShell file insert?
Reply #17 - Nov 26th, 2008 at 4:43pm
Print Post Print Post  
Thanks. May I see the declaration line for vPath, please?

Are you running standalone or client/server? If client/server, is C:\My.jpg on the client or on the server?

BTW, that third variation has the jpg in the wrong position for a binary attachment, so it's not surprising that it's acting funny.
  

- Hammer
The plural of anecdote is not data.
Back to top
IP Logged
 
tcgeo
Full Member
***
Offline



Posts: 278
Location: Traverse City, Michigan
Joined: May 13th, 2008
Re: @ASynchShell file insert?
Reply #18 - Nov 26th, 2008 at 5:04pm
Print Post Print Post  
var vPath as String

vPath = "C:\my.jpg"

writeln(vpath) does show correct and entire path.

Running standalone

The third variation was just stabbing in the dark.

Thanks for your help with this.
  
Back to top
IP Logged
 
Hammer
YaBB Administrator
Lanticans
*****
Offline


Fire bad. Tree pretty.

Posts: 3436
Location: Ohio
Joined: Nov 22nd, 2002
Re: @ASynchShell file insert?
Reply #19 - Nov 26th, 2008 at 5:59pm
Print Post Print Post  
OK, try this and tell me what number appears in the WriteLn window.

Code
Select All
var vFlag as Int
var vPath as String

    vPath = "C:\my.jpg"
    vFlag = @SendMail("smtp.charter.net","My Sesame Test email", "From@charter.net","To@charter.net","","","My message", "", "",vPath)
    WriteLn(vFlag)
 



  

- Hammer
The plural of anecdote is not data.
Back to top
IP Logged
 
tcgeo
Full Member
***
Offline



Posts: 278
Location: Traverse City, Michigan
Joined: May 13th, 2008
Re: @ASynchShell file insert?
Reply #20 - Nov 26th, 2008 at 6:18pm
Print Post Print Post  
vFlag = -6
  
Back to top
IP Logged
 
Hammer
YaBB Administrator
Lanticans
*****
Offline


Fire bad. Tree pretty.

Posts: 3436
Location: Ohio
Joined: Nov 22nd, 2002
Re: @ASynchShell file insert?
Reply #21 - Nov 26th, 2008 at 7:20pm
Print Post Print Post  
tcgeo wrote on Nov 26th, 2008 at 6:18pm:
vFlag = -6


That error indicates that the operating system was unable to open the specified file.  Give us a little bit. We'll run some tests and see if it behaves the same way for us.
  

- Hammer
The plural of anecdote is not data.
Back to top
IP Logged
 
tcgeo
Full Member
***
Offline



Posts: 278
Location: Traverse City, Michigan
Joined: May 13th, 2008
Re: @ASynchShell file insert?
Reply #22 - Nov 26th, 2008 at 7:28pm
Print Post Print Post  
Thank you, I appreciate it!
  
Back to top
IP Logged
 
Hammer
YaBB Administrator
Lanticans
*****
Offline


Fire bad. Tree pretty.

Posts: 3436
Location: Ohio
Joined: Nov 22nd, 2002
Re: @ASynchShell file insert?
Reply #23 - Nov 26th, 2008 at 7:41pm
Print Post Print Post  
tcgeo wrote on Nov 26th, 2008 at 7:28pm:
Thank you, I appreciate it!


We are able to use @SendMail attach a jpg with the filename in a variable. Check the filename you are assigning to the variable very carefully. A slash that goes the wrong way, a space in the wrong place, a minor misspelling...anything like that will make it so the file to be attached can't be found. Does the filename have spaces in it?
  

- Hammer
The plural of anecdote is not data.
Back to top
IP Logged
 
tcgeo
Full Member
***
Offline



Posts: 278
Location: Traverse City, Michigan
Joined: May 13th, 2008
Re: @ASynchShell file insert?
Reply #24 - Nov 26th, 2008 at 8:00pm
Print Post Print Post  
I put the .jpg on the root folder and it worked.

The folder that it was in has an underscore like this:

Sesame2_1

Must be the underscore causing trouble?

Thank you for all of your time.
  
Back to top
IP Logged
 
Ben
Lantica Support
*****
Offline



Posts: 218
Joined: Apr 7th, 2005
Re: @ASynchShell file insert?
Reply #25 - Nov 26th, 2008 at 8:15pm
Print Post Print Post  
The issue you are running into does not appear to be caused by the use of underscores. Would it be possible for you to send in the JPG file you are trying to attach to the email, as well as the file path to the directory where the image is kept? If you can send in that information we should be able to figure out what you are running into.

You can email the information to support@lantica.com.

-Ben
Lantica Technical Support
  
Back to top
IP Logged
 
tcgeo
Full Member
***
Offline



Posts: 278
Location: Traverse City, Michigan
Joined: May 13th, 2008
Re: @ASynchShell file insert?
Reply #26 - Nov 26th, 2008 at 9:05pm
Print Post Print Post  
Will do Ben, Thank you.
  
Back to top
IP Logged
 
Hammer
YaBB Administrator
Lanticans
*****
Offline


Fire bad. Tree pretty.

Posts: 3436
Location: Ohio
Joined: Nov 22nd, 2002
Re: @ASynchShell file insert?
Reply #27 - Nov 26th, 2008 at 10:20pm
Print Post Print Post  
tcgeo,

We got your code. Your path has a dot (.) in one of the folder names. This is likely to cause evil. Try a path with no dots.
  

- Hammer
The plural of anecdote is not data.
Back to top
IP Logged
 
tcgeo
Full Member
***
Offline



Posts: 278
Location: Traverse City, Michigan
Joined: May 13th, 2008
Re: @ASynchShell file insert?
Reply #28 - Nov 26th, 2008 at 11:47pm
Print Post Print Post  
You're right, thank you so much for your help and time.

I had no idea that would cause troubles. I certainly won't make that mistake again.

  
Back to top
IP Logged