forum.vdsworld.com Forum Index forum.vdsworld.com
Visit VDSWORLD.com
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


SEND MAIL USING DEFAULT SMTP CLIENT - UNLIMITED ATTACHMENTS

 
Post new topic   Reply to topic    forum.vdsworld.com Forum Index -> Visual DialogScript 4 Source Code
View previous topic :: View next topic  
Author Message
CodeScript
Moderator Team


Joined: 08 Jun 2003
Posts: 1054
Location: India

PostPosted: Mon Jul 07, 2003 5:32 pm    Post subject: SEND MAIL USING DEFAULT SMTP CLIENT - UNLIMITED ATTACHMENTS Reply with quote

SENDING MAIL THROUGH DEFAULT SMTP CLIENT WITH UNLIMITED ATTACHMENTS.
This script heps you send e-mail message with attcahments of any kind through your default email client -eg MS OUTLOOK, OUTLOOK EXPRESS, EUDORA etc.However it will not work if no e-mail client is setup on your machine.(This script does nothing more than dumping the data into your default email client !)
You may hide the default client and use window send and send the mail but this may not be always reliable.
You can also use any VDS SMTP dll to directly send mail from your program even if the dll doesnot support attachments by suitable changes to the script - However this still requires that user has a SMTP email access.

The Script needs MPACK15 a MIME encoder to work.You can get it from:

ftp://ftp.andrew.cmu.edu/pub/mpack/ and pplace it in the same directory after extracting the files from the package.

You can get all the files in a zip file.
"http://www.geocities.com/codescript2002/MAILER.zip"
If U want a cleaner and sophisticated access you should go for vdsipp03.dll by PGWARE.
Use at your own risk.
Code:

REM SENDING MAIL THROUGH DEFAULT SMTP CLIENT WITH ATTACHMENTS.
REM
REM AUTHOR: CODESCRIPT
REM
REM
REM The Script needs MPACK15 a MIME encoder to work.You can get it from:
REM ftp://ftp.andrew.cmu.edu/pub/mpack/

REM "PORTIONS OF THIS SOFWARE ARE Copyright 1993,1994 by Carnegie Mellon University,
REM AND from code written by Bell Communications research, Inc. (Bellcore)
REM RSA Data Security,Inc."
REM Acknowledgements FLY TO John G. Myers, jgm+@cmu.edu
REM "THIS SCRIPT COMES WITH ABSOLUTELY NO WARRANTY OR FITTNESS FOR ANY
REM SITAUTION/JOB/INSTALLATION"
REM THE USER AGREEES TO USE AT HIS/HER OWN RISK.
REM PERMISSION TO USE/COPY THIS SCRIPT FREE IS GRANTED PROVIDED THE ABOVE INFO IS
REM LEFT INTACT.YOU ALSO AGREE TO KEEP INTACT THE COPYRIGHT NOTICE OF ACCOMPANYING
REM PACKAGE AND ADD THEIR COPYRIGHT NOTICE TO THE DOCUMENTATION.
REM
REM
REM SINCE THE SCRIPT USES A DOS PROGRAM INSTALLING IN DIRECTORY WITH SHORT PATH
REM HELP AVOID FILE NAME PROBLEMS AND RELATED SCRIPT ERRORS.

Title SMTP mail with attachments for default E-mail client.
  DIALOG CREATE,Send Mail by CodeScript,-1,0,516,424,CLASS MYWIN,
  DIALOG ADD,STYLE,STYLE1,verdana,9,,,
  DIALOG ADD,STYLE,STYLE2,Comic Sans MS,10,,,
  DIALOG ADD,GRADIENT,GRADIENT1,0,0,519,427,EBE7D8,EBE7D8,,LEFTTORIGHT,FIT
  DIALOG ADD,EDIT,EDIT1,38,66,390,22,,,STYLE1
  DIALOG ADD,EDIT,EDIT2,64,66,390,22,,,STYLE1
  DIALOG ADD,EDIT,EDIT3,90,66,390,22,,,STYLE1
  DIALOG ADD,EDIT,EDIT4,116,66,390,22,,,STYLE1
  DIALOG ADD,LIST,LIST2,142,66,338,44,,click
  DIALOG ADD,BUTTON,Attach,144,406,50,20,Attach
  DIALOG ADD,BUTTON,Remove,168,406,50,20,Remove
  DIALOG ADD,EDIT,EDIT5,190,66,390,168,,,STYLE2,MULTI,WRAP,SCROLL
  DIALOG ADD,BUTTON,SEND,374,184,136,24,SEND
  DIALOG ADD,TEXT,TEXT1,44,32,,,To:,,TRANSPARENT
  DIALOG ADD,TEXT,TEXT2,70,32,,,Cc:,,TRANSPARENT
  DIALOG ADD,TEXT,TEXT3,96,28,,,Bcc:,,TRANSPARENT
  DIALOG ADD,TEXT,TEXT4,122,20,,,Subject :,,TRANSPARENT
  DIALOG ADD,TEXT,TEXT5,156,24,,,Attach :,,TRANSPARENT
  DIALOG ADD,TEXT,TEXT6,200,14,,,Message :,,TRANSPARENT,
  DIALOG SHOW
  DIALOG DISABLE,Remove
:Evloop
  wait event
  goto @event()
 
 
:AttachBUTTON
  %%Attach = @filedlg("All Files (*.*)|*.*",Attach a File,,oen)
  if @not(@null(%%Attach))
    list add,LIST2,%%Attach
   END
  goto evloop
:RemoveBUTTON
  If @not(@equal(@count(LIST2),0))
    list delete,LIST2
  else
  end
  If @equal(@count(LIST2),0)
    dialog disable,Remove
  else
  end
  goto evloop
 
:LIST2CLICK
 DIALOG ENABLE,REMOVE
goto evloop

:SENDBUTTON
DIALOG DISABLE,SEND
REM DEFINE VARIABLES:
%%Recipient = @DLGTEXT(EDIT1)
%%CC = @DLGTEXT(EDIT2)
%%BCC = @DLGTEXT(EDIT3)
%%SUB = @DLGTEXT(EDIT4)
%%MESSAGE = @DLGTEXT(EDIT5)

:INITIALIZE
LIST CREATE,1
LIST LOADTEXT,1
LIST ADD,1,From:
LIST ADD,1,To: <%%Recipient>
LIST ADD,1,Cc: <%%CC>
LIST ADD,1,Bcc: <%%BCC>
LIST ADD,1,Subject: %%SUB
LIST ADD,1,Date: @datetime(dddddd tt)
LIST ADD,1,MIME-Version: 1.0
LIST ADD,1,Content-Type: multipart/mixed;
LIST ADD,1,@CHR(32)boundary=@CHR(34)----@CHR(34)
LIST ADD,1,X-Priority: Normal
LIST ADD,1,X-MSMail-Priority: Normal
LIST ADD,1,X-Unsent: 1
LIST ADD,1,X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2600.0000
LIST ADD,1,
LIST ADD,1,This is a multi-part message in MIME format.
LIST ADD,1,------
LIST ADD,1,Content-Type: text/plain;
LIST ADD,1,@CHR(32)charset=@CHR(34)iso-8859-1@CHR(34)
LIST ADD,1,Content-Transfer-Encoding: 7bit
LIST ADD,1,
LIST ADD,1,%%MESSAGE
LIST ADD,1,
%A = 0

:SEEKATTACHMENT
IF @equal(%A,@count(LIST2))
 goto FINISH
 end
  List seek,LIST2,%A
  %%file = @item(LIST2)
     IF @not(@NULL(%%file))
     %A = @succ(%A)
     LIST ADD,1,------
    goto CONVERT
    else
    goto FINISH

:CONVERT
%%file1 = @shortname(%%file)
%%name = @name(%%file1)

RUNh  @shortname(@path(%0)mpack.exe) -s 1 -o %%name.uue %%file1,wait
OPTION ERRORTRAP,ERR1
List Create,5
LIST LOADFILE,5,%%name.uue
LIST DELETE,5,0
LIST DELETE,5,1
LIST DELETE,5,2
LIST DELETE,5,3
LIST DELETE,5,4
LIST DELETE,5,5
LIST DELETE,5,6
LIST DELETE,5,7
LIST DELETE,5,8
LIST REVERSE,5,
LIST DELETE,5,0
LIST REVERSE,5,
LIST APPEND,1,5

LIST CLOSE,5
FILE DELETE,%%name.uue
goto SEEKATTACHMENT

:FINISH
LIST REVERSE,1
LIST SEEK,1,0
LIST PUT,1,--------
LIST REVERSE,1
LIST SAVEFILE,1,@path(%0)10.eml
end
Window hide,#MYWIN
SHELL "",@path(%0)10.eml
:Animate
  DIALOG CREATE,Progress,-1,0,273,96,NOTITLE,ONTOP
  DIALOG ADD,STYLE,STYLE3,Arial,,B,,
  DIALOG ADD,PROGRESS,PROGRESS1,42,40,188,24,0,,,,SMOOTH
  DIALOG ADD,TEXT,TEXT1,10,94,,,Please Wait....,,STYLE3
  DIALOG SHOW
  %S =0
  REPEAT
  %S = @SUM(%S,20)
  DIALOG SET,PROGRESS1,%S
  wait 0.001
  UNTIL @GREATER(%S,100)
exit

:ERR1
WARN Failed processing attachments ! @CR()Try installing the program with a lesser directory depth eg. C:\Program Files\Mailer@CR()It may also be that you have selected a file more than 8 directories deep which is not supported.
exit

:Close
exit
_______________________________________________________________________


EDIT:
Fixed some problems:
Now it can be run from a directory like C:\Program files\mailer.
Files can be attached from upto 8 directories deep.
Added a progess element just before closing(cosmetic).
Tested with Out look express 2002 as default client. If it doesnt work let me know. If I have that client i wil have a look.

_________________
Regards
- CodeScript
Arrow Give your application a professional look with the VDSGUI Extension
Back to top
View user's profile Send private message Visit poster's website
Boo
Valued Contributor
Valued Contributor


Joined: 31 Oct 2003
Posts: 599
Location: Gulf Breeze, Florida USA

PostPosted: Sun Dec 21, 2003 3:17 am    Post subject: Reply with quote

Hi CodeScript,

Back to this one. How can this be made to work with a client other than Outlook Express? I have tested it on my PC (FYI: Outlook, not Outlook Express, is my default client), but it always opens Outlook Express. I tried renaming the .eml file, but still no go.

Any ideas?

Thanks,

- Boo
Back to top
View user's profile Send private message
CodeScript
Moderator Team


Joined: 08 Jun 2003
Posts: 1054
Location: India

PostPosted: Mon Dec 22, 2003 5:01 am    Post subject: Reply with quote

I think MS outlook uses a different format/way to sore the composed mail.
Need to have a look. You can try saving a composed mail in outlook to a given place and then see what extension it has..
BTW there are many other ways - mostly using dlls to send mails using pop protocol which are independent of any email clients installed on the users computer.

_________________
Regards
- CodeScript
Arrow Give your application a professional look with the VDSGUI Extension
Back to top
View user's profile Send private message Visit poster's website
Boo
Valued Contributor
Valued Contributor


Joined: 31 Oct 2003
Posts: 599
Location: Gulf Breeze, Florida USA

PostPosted: Tue Dec 23, 2003 9:04 am    Post subject: Reply with quote

Thanks CodeScript.

By the way... Is there a way to find a user's smtp and pop information (such as mail.somewhere.com) from the Windows registry?

Cheers,

- Boo
Back to top
View user's profile Send private message
Vic D'Elfant
Past Contributor
Past Contributor


Joined: 26 Jun 2002
Posts: 673
Location: The Netherlands

PostPosted: Sat Dec 27, 2003 11:01 am    Post subject: Reply with quote

This is only possible when the user is using Outlook.

If so, you need his default email account id, which you can find in HKEY_CURRENT_USER\Software\Microsoft\Office\Outlook\OMI Account Manager\Default Mail Account.

Then, you can get it's server information in HKEY_CURRENT_USER\Software\Microsoft\Office\Outlook\OMI Account Manager\Accounts\<mail account id>\

Best regards Very Happy,
Vic

_________________
phpBB Development Team
Back to top
View user's profile Send private message Visit poster's website
Boo
Valued Contributor
Valued Contributor


Joined: 31 Oct 2003
Posts: 599
Location: Gulf Breeze, Florida USA

PostPosted: Sat Dec 27, 2003 6:43 pm    Post subject: Reply with quote

Thanks Vic!
Back to top
View user's profile Send private message
Vic D'Elfant
Past Contributor
Past Contributor


Joined: 26 Jun 2002
Posts: 673
Location: The Netherlands

PostPosted: Sat Dec 27, 2003 6:57 pm    Post subject: Reply with quote

Glad to help Smile

Vic

_________________
phpBB Development Team
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    forum.vdsworld.com Forum Index -> Visual DialogScript 4 Source Code All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You can attach files in this forum
You can download files in this forum




Twitter@vdsworld       RSS

Powered by phpBB © 2001, 2005 phpBB Group