View previous topic :: View next topic
|
Author |
Message |
Kumaresan.nk
New User
Joined: 22 Mar 2010 Posts: 31 Location: Chennai
|
|
|
|
Hi,
I'm trying to ZIP an excel file and send it in mail. I tried SAS and IEBGENER. But am not able to get the zip file as attachment. Here's the code i used -
SAS Code:
DATA REPORT;
FORMAT DATE1 MMDDYY8.;
CALL SYMPUT ('HDATE',PUT(TODAY(),MMDDYY8.));
FORMAT EMAILDATE MMDDYY8.;
PUT "!EM_SUBJECT!" "HDATE11";
FILENAME MYFILE EMAIL
FROM= ("emailid")
TO= ("emailid")
ATTACH=("*.*.*.ZIP" NAME='NYBROK Report'
EXTENSION='ZIP')
TYPE= "TEXT/PLAIN";
DATA REPORT;
SET REPORT;
FILE MYFILE;
PUT "!EM_SUBJECT!" "NY REPORT";
PUT "Please find attached the NY COMSN REPORT";
PUT "run &HDATE . ";
RUN;
Code Used to ZIP using PKZIP:
-TRANSLATE_TABLE_DATA(EBC#xxxx)
-DATA_DELIMITER(LF)
-FILE_TERMINATOR()
-ARCHIVE_OUTFILE(ZIPOUT)
-ARCHIVE_COMMENT(ZIP FOR DMS)
-ENCRYPTION_METHOD(STANDARD)
-ACTION(ADD)
-INFILE(INFILE)
-ZIPPED_DSN(*,*.*.*)
Code used with IEBGENER:
HELO 'server address'
MAIL FROM: <emailid>
RCPT TO: <emailid>
DATA
FROM: <emailid>
TO: <Kumaresan.Neelakandan@COGNIZANT.COM>
SUBJECT: NY REPORT
MIME-VERSION: 1.0
CONTENT-TYPE: MULTIPART/MIXED;BOUNDARY="MIME"
--MIME
CONTENT-TYPE: APPLICATION/ZIP; CHARSET=US-ASCII
CONTENT-TRANSFER-ENCODING: 7BIT
Hi All,
Attached above is the NY BRoker Commission Report for your
reference.
--MIME
CONTENT-TYPE: APPLICATION/ZIP
CONTENT-DISPOSITION: ATTACHMENT; FILENAME=NYBROK.XLS
My requirement is to zip an excel file and the send it as an email. |
|
Back to top |
|
|
superk
Global Moderator
Joined: 26 Apr 2004 Posts: 4652 Location: Raleigh, NC, USA
|
|
|
|
TYPE= "TEXT/PLAIN";
Does that seem right to you? |
|
Back to top |
|
|
PeterHolland
Global Moderator
Joined: 27 Oct 2009 Posts: 2481 Location: Netherlands, Amstelveen
|
|
Back to top |
|
|
Robert Sample
Global Moderator
Joined: 06 Jun 2008 Posts: 8697 Location: Dubuque, Iowa, USA
|
|
|
|
If you're going to use SAS, use SAS and follow the example Peter cited -- or better yet look up on the SAS web site the details for yourself. If you're going to use SMTP, use SMTP and get rid of every bit of SAS code you've got. What you have done is mix SMTP and SAS -- which generally becomes a big mess and certainly will not give you what you think it will. |
|
Back to top |
|
|
PeterHolland
Global Moderator
Joined: 27 Oct 2009 Posts: 2481 Location: Netherlands, Amstelveen
|
|
|
|
Robert,
you are totally right, mixing mailing solutions (?) will lead to nothing.
Its the same like mailing part by carrier pigeons AND part by floppy discs. |
|
Back to top |
|
|
Robert Sample
Global Moderator
Joined: 06 Jun 2008 Posts: 8697 Location: Dubuque, Iowa, USA
|
|
|
|
Peter: and those carrier pigeons REALLY hate having floppy discs strapped to their legs! |
|
Back to top |
|
|
PeterHolland
Global Moderator
Joined: 27 Oct 2009 Posts: 2481 Location: Netherlands, Amstelveen
|
|
|
|
Robert Sample wrote: |
Peter: and those carrier pigeons REALLY hate having floppy discs strapped to their legs! |
Robert,
are you by chance a pigeon fancier? |
|
Back to top |
|
|
Robert Sample
Global Moderator
Joined: 06 Jun 2008 Posts: 8697 Location: Dubuque, Iowa, USA
|
|
|
|
Actually, no -- but I like the image of a pigeon flying along with a floppy disk attached to its leg .... |
|
Back to top |
|
|
enrico-sorichetti
Superior Member
Joined: 14 Mar 2007 Posts: 10873 Location: italy
|
|
|
|
shall we start speculating on how having additional surface exposed to the air flow
might let pigeons float better by putting less strain on the wings ?? |
|
Back to top |
|
|
Grant Goodale
New User
Joined: 13 Nov 2010 Posts: 67 Location: Brampton, Ontario, Canada
|
|
|
|
Enrico -
It might be carried in the same way as a coconut can be carried by swallows. Then the question is - African or European swallows. |
|
Back to top |
|
|
Kumaresan.nk
New User
Joined: 22 Mar 2010 Posts: 31 Location: Chennai
|
|
|
|
Hi,
Now, I'm able to get the ZIP file as attachment in mail. But am not able to get the message that is supposed to be displayed in the body of the mail. I used the following SAS code -
DATA REPORT;
FORMAT DATE1 MMDDYY8.;
CALL SYMPUT ('HDATE',PUT(TODAY(),MMDDYY8.));
FORMAT EMAILDATE MMDDYY8.;
PUT "!EM_SUBJECT!" "HDATE11";
FILENAME MYFILE EMAIL
FROM= ("EMAIL-ID")
TO= ("EMAIL-ID")
ATTACH=("TEST.XXX.XXX.REPORT.ZIP" NAME='NY BROKER REPORT'
EXTENSION='ZIP')
TYPE= "APPLICATION/ZIP";
DATA REPORT;
SET REPORT;
FILE MYFILE;
PUT "!EM_SUBJECT!" "XXX NY BROKER COMMISSION REPORT ";
PUT "Attached is the NY BROKER COMMISSION REPORT";
PUT "run &HDATE . ";
RUN;
QUIT;
Can anyone let me know what might be the issue with this, please. |
|
Back to top |
|
|
|