problems with email

Postby Antonio Linares » Mon May 19, 2008 12:07 pm

Moises,

Try this:

"mailto:{0}?Subject={1}&Body={2}&Attach={3}"

Replace {n} with the values
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42122
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Postby James Bott » Mon May 19, 2008 1:26 pm

Moises,

I found these in my notes (for MAPI). It may help.

James

-----------------------
If you specify a TO and the parameter is blank and you are using the FROM USER clause, the message compose box will not appear. Likewise if the filename is invalid or not found. It is best to use an error trap:

Code: Select all  Expand view  RUN
   DEFINE MAIL...
   ACTIVATE MAIL...

   IF oMail:nRetCode!=0
      MsgAlert("The message could not be sent due to an error."+CRLF+;
      "MAPI error code: "+ltrim(str(oMail:nRetCode)),"Alert")
   ENDIF

------------------------
MAPI error codes

SUCCESS_SUCCESS 0
MAPI_USER_ABORT 1
MAPI_E_FAILURE 2
MAPI_E_LOGIN_FAILURE 3
MAPI_E_DISK_FULL 4
MAPI_E_INSUFFICIENT_MEMORY 5
MAPI_E_ACCESS_DENIED 6
MAPI_E_TOO_MANY_SESSIONS 8
MAPI_E_TOO_MANY_FILES 9
MAPI_E_TOO_MANY_RECIPIENTS 10
MAPI_E_ATTACHMENT_NOT_FOUND 11
MAPI_E_ATTACHMENT_OPEN_FAILURE 12
MAPI_E_ATTACHMENT_WRITE_FAILURE 13
MAPI_E_UNKNOWN_RECIPIENT 14
MAPI_E_BAD_RECIPTYPE 15
MAPI_E_NO_MESSAGES 16
MAPI_E_INVALID_MESSAGE 17
MAPI_E_TEXT_TOO_LARGE 18
MAPI_E_INVALID_SESSION 19
MAPI_E_TYPE_NOT_SUPPORTED 20
MAPI_E_AMBIGUOUS_RECIPIENT 21
MAPI_E_MESSAGE_IN_USE 22
MAPI_E_NETWORK_FAILURE 23
MAPI_E_INVALID_EDITFIELDS 24
MAPI_E_INVALID_RECIPS 25
MAPI_E_NOT_SUPPORTED 26

------------------------------
MAPISEND.EXE is a free program available here:

www.lexacorp.com.pg


Usage: MAPISEND /A address(s) [/N name(s)][/S subject][/B body][/F filenames(s)][/R][/E]

If name is included it must be give AFTER address. Filenames should include full paths, separate filenames with semi-colon(;)

If /R is included, a Response will be given indicating that a message has been sent.

If /E is included, the Email program will be opened with the Message available for editing. You can pass just /E and get an empy new message dialog.

If you don't use /E the mail is sent automatically and you will probably get a warning dialog from Outlook or OE, that mail is being sent. You can turn this off in OE under Tools-Options-Security; "Warn when other applications send mail as me."

Note: Don't use quotes around the path+filename.

/S - Subject cannot be longer than 23 characters. If so, mail progam doesn't run. Cannot contain slashes either (can use dashes).

This will work under XP (32 bit MAPI). It doesn't provide CC, BC, or return receipt (you can manually add those if you use /E).



Here is an example of how to use it from within FW:

Code: Select all  Expand view  RUN
/*
Purpose: Test using MapiSend.exe from inside FW
*/

#include "fivewin.ch"

function main()

   local cParams:=""

     cParams:= [ /E /A whoever@hotmail.com /S "Invoice" /B "See attached." /F c:\documents and settings\james\my documents\temp\test.html]

     // You can use shellexecute()
     //SHELLEXECUTE( 0, 0, "mapisend", cParams, 0, 1 )

     // You may use waitRun() instead. You will need to if you are mailing a temp file
     // and you want to delete it after mailing.
     waitRun( "mapisend "+ cParams)
     
     sysrefresh()
     
     msgInfo("")

return nil


---------------------------------
User avatar
James Bott
 
Posts: 4840
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA

Postby MOISES » Mon May 19, 2008 1:54 pm

Antonio,

I am afraid your code does not work. It shows OK the destination, subject and body, but not the ATTACHMEND. Did you try it?.

Thank you
MOISES
 
Posts: 838
Joined: Wed Aug 22, 2007 10:09 am

Postby James Bott » Mon May 19, 2008 2:54 pm

Moises,

You must provide the full path to the attachment. Did you do this?

Also, if it has spaces in it, you probably have to use quotes around it.

James
User avatar
James Bott
 
Posts: 4840
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA

Postby MOISES » Mon May 19, 2008 3:16 pm

James:

You were right!!!. I must provide the full path, with letter.

But surprilingly, at the second time with wrong path it works!!!.

Thank you James for your help!!!.

Best regards,
MOISES
 
Posts: 838
Joined: Wed Aug 22, 2007 10:09 am

Postby James Bott » Mon May 19, 2008 3:23 pm

Moises,

Glad to hear you got it working. MAPI is a great tool, but it can be a pain.

James
User avatar
James Bott
 
Posts: 4840
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA

Previous

Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: Google [Bot], nageswaragunupudi and 75 guests