problems with email

User avatar
Antonio Linares
Site Admin
Posts: 37481
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

Post by Antonio Linares »

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
James Bott
Posts: 4654
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA
Contact:

Post by James Bott »

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

   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

/*
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
---------------------------------
MOISES
Posts: 824
Joined: Wed Aug 22, 2007 10:09 am

Post by MOISES »

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
User avatar
James Bott
Posts: 4654
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA
Contact:

Post by James Bott »

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
MOISES
Posts: 824
Joined: Wed Aug 22, 2007 10:09 am

Post by MOISES »

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,
User avatar
James Bott
Posts: 4654
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA
Contact:

Post by James Bott »

Moises,

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

James
Post Reply