Delphi Pages Forums  

Go Back   Delphi Pages Forums > Delphi Forum > General

Lost Password?

Reply
 
Thread Tools Display Modes
  #1  
Old 03-09-2010, 04:33 PM
mobiusonline mobiusonline is offline
Junior Member
 
Join Date: Mar 2010
Posts: 5
Default ShellExecute mailto with attachment

I am trying to create a support portion for my program that will email the log file that is created as an attachment. When I try to run, I get:

[Error] Unit94.pas(278): E2010 Incompatible types: 'string' and 'PAnsiChar'

I know I can just set it statically, but the program could be installed in another location, and the log would be in a different location.

Code:
272 ShellExecute(Self.Handle,
273             nil,
274             'mailto:' +
275             'email@address.com' +
276             '?Subject=Emailing Log file' + 
277             '&Body=Please fill in details of your error to send in for support.' +
278             '&Attachment="'+Application.ExeName+GL_local_Log+'"',
279             nil,
280             nil,
281             SW_NORMAL);
Reply With Quote
  #2  
Old 03-09-2010, 05:48 PM
abcd abcd is offline
Senior Member
 
Join Date: Nov 2009
Posts: 134
Default

PAnsiChar(Application.ExeName) or pAnsiChar(GL_Local_Log) ?
Reply With Quote
  #3  
Old 03-10-2010, 08:11 AM
Norrit Norrit is offline
Moderator
 
Join Date: Aug 2001
Location: Landgraaf
Posts: 7,307
Default

Instead of ShellExecute have a look at the SMAPI protocol. It does the same, work with the default email client, but has much more options... On Mike's site there's the TSMMAPIMail component...

And as for you error, abcd is right, you should pass it as PChar (or PAnsiChar)...
Reply With Quote
  #4  
Old 03-13-2010, 11:45 PM
mobiusonline mobiusonline is offline
Junior Member
 
Join Date: Mar 2010
Posts: 5
Default

Thanks Norrit. That worked perfectly.
Reply With Quote
  #5  
Old 03-14-2010, 03:32 AM
MrBaseball34 MrBaseball34 is offline
Senior Member
 
Join Date: Jan 2001
Posts: 7,260
Default

It is NOT recommended to use this approach because it is not guaranteed that the customer's email client will work with that command line.
__________________
MrBaseball34

Hook 'em Horns
2005 College Football National Champions
2005 College Baseball National Champions
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is On

Forum Jump


All times are GMT. The time now is 11:18 PM.


Powered by vBulletin® Version 3.8.8
Copyright ©2000 - 2018, vBulletin Solutions, Inc.