473,396 Members | 2,121 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Password Addition

Hi ,

In my Perl Application, a mail is send to the administrator.
This mail contains an attachment which is a csv sheet.
Now, i need to add a Password to the same.

The coding that i follow is:
Expand|Select|Wrap|Line Numbers
  1. if($attachfile ne ""){
  2.                 $msg->attach( 
  3.                         binmode => 1,   
  4.                         Type     =>'BINARY',
  5.                         Path     =>"$DataPath$attachfile",
  6.                         Encoding =>'base64',
  7.                         Filename =>$attachfile);
  8.         }
  9.  
Oct 3 '07 #1
12 1436
KevinADC
4,059 Expert 2GB
What is the password for? I don't understand your question.
Oct 3 '07 #2
In the application a mail is sent to the user with an attached csv sheet.
This attachment when opened should ask for a password.

Like in excel sheet you go to
tools-> options->secuirty and add a password.
This has to be built in the application code.

I found somewhere as protect->'Paasword' but this is not working.
Oct 3 '07 #3
KevinADC
4,059 Expert 2GB
I don't know if that is possible. Which perl module are you using?
Oct 3 '07 #4
Hi,


I'm using #!/usr/local/bin/perl5

I guess it's possible as I'va found out but not able to integrate it with the code:

Check this out "http://www.perlmonks.org/?node_id=522233".
$worksheet->protect('mysillypassword');

I can convert the csv into an excel sheet though.
Oct 3 '07 #5
KevinADC
4,059 Expert 2GB
I meant which module are you using for this:

$msg->attach(

there must be a :

use NET::SMTP

or

use MIME::Lite

in the script somewhere. What you posted is the path to perl: #!/usr/local/bin/perl5

I think you need to add the password when you create the excel file, not when sending it as an email attachment.
Oct 3 '07 #6
I'm using :

use MIME::Base64;
use CGI;
Oct 3 '07 #7
KevinADC
4,059 Expert 2GB
I'm using :

use MIME::Base64;
use CGI;

neither of those modules has an attach() method that I am aware of. I assume you are using MIME::Lite. There is no password field you can add to an email message that I am aware of.
Oct 3 '07 #8
eWish
971 Expert 512MB
Password protecting an email... I don't know of any module that does that. Can you password protect the file with the application that you are creating it in? Can you email the person a link to download the file. Then when authenticated they can download the file.

Like Kevin said look at MIME:Lite or even Mail::Sender. Both of these modules will allow to you send attachments.
Oct 4 '07 #9
Hi,

I send the mail as an attachment using the following piece of code:
Expand|Select|Wrap|Line Numbers
  1. sub Mail {
  2.  
  3. #-----ER2   RISBANSA  01 APRIL 2004  START-------#
  4.  
  5.         local($from,$to1,$to2,$cc,$bcc,$attachfile,$subject_org,$body)=@_;
  6.         $subject = 'xxx encode_base64($subject_org, '') . '?=';
  7.         $body=~s/\r/\r\n/gi;
  8.  
  9.         $msg = new MIME::Lite 
  10.                 From   =>$from,
  11.                 To       =>$to1,
  12.                 To       =>$to2,
  13.                 Cc      =>$from,
  14.     Cc      =>$cc,
  15.                 Bcc    =>$bcc,
  16.                 Subject =>$subject,
  17.                 Type    =>'multipart/mixed';
  18.  
  19.        $msg->attach(
  20.                 Type     =>'TEXT',
  21.                 Encoding =>'7bit',
  22.                 Data     =>$body);
  23.  
  24.        if($attachfile ne ""){
  25.                 $msg->attach( 
  26.                         binmode => 1,   
  27.                         Type     =>'BINARY',
  28.                         Path     =>"$DataPath$attachfile",
  29.                         Encoding =>'base64',
  30.                         Filename =>$attachfile);
  31.         }
  32.  
  33.       $msg->send;
  34.  
So please tell me where can I add a password to this attachment ?
Oct 4 '07 #10
KevinADC
4,059 Expert 2GB
You can include a password in the body ($body) of the email message but thats all you can do. You can not attach a password or add it to the attachment. At least not that I know of.
Oct 4 '07 #11
Could you tell me where exactly do I add the password in the body as I've been trying all possible things.
Oct 4 '07 #12
KevinADC
4,059 Expert 2GB
The body is already composed before the function you posted:
Expand|Select|Wrap|Line Numbers
  1. sub Mail {
  2.  
  3. #-----ER2 RISBANSA 01 APRIL 2004 START-------#
  4.  
  5. local($from,$to1,$to2,$cc,$bcc,$attachfile,$subjec t_org,$body)=@_;
  6.  
So it seems it should be added earlier. You could append it to the end of the $body variable:

Expand|Select|Wrap|Line Numbers
  1. local($from,$to1,$to2,$cc,$bcc,$attachfile,$subjec t_org,$body)=@_;
  2. $subject = 'xxx encode_base64($subject_org, '') . '?=';
  3. $body .= "\nhere is the password: rosebud\n"; 
  4. $body=~s/\r/\r\n/gi;
  5.  
but that seems like the wrong place to be adding it and without knowing what is already in $body it might not even be appropriate.
Oct 4 '07 #13

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: D. Alvarado | last post by:
What recommendations do you have about how to validate web pages that are password protected, short of saving the page, uploading it to a public server, and then running it through a validator? ...
2
by: vishwa h via .NET 247 | last post by:
HI, I am getting an error "Exception has been thrown by the target of an invocation" when I executing the following code. User "abc" is already created under the OU(Sas). Try Dim...
36
by: dcrespo | last post by:
Hi all, I have a program that serves client programs. The server has a login password, which has to be used by each client for logging in. So, when the client connects, it sends a string with a...
1
by: Bryan Russell | last post by:
I've taken over an access database and was provided the admin password. My first task is to change the admin password, but my problem is that the 'Tools' menu has been removed to access the...
34
by: Andy | last post by:
Hi, Are 1 through 4 defined behaviors in C? unsigned short i; unsigned long li; /* 32-bit wide */ 1. i = 65535 + 3; 2. i = 1 - 3; 3. li = (unsigned long)0xFFFFFFFF + 3; 4. li = 1...
6
by: Andre Ranieri | last post by:
I'm trying to create a login page for customers to log into our corporate website, our presidents naturally wants the user and password fields to populate from a cookie so the customer doesn't have...
2
by: Daniel | last post by:
Hi All, Does anyone know how to encrypt the password before store in the sql database? In addition, decrypt the password from database before comparison. The purpose to do it because to hide the...
2
by: moi | last post by:
Hello, i have a Asp.net V2 login page with a password to enter. In some case, a user could forget and tell IE to save its password : How to prevent it ? Is there a way to disable it ? to block...
0
by: shashank kadge | last post by:
You can set it to integer, if u dont want to use ADS constant. 544 - to enable the user object 66048 - for Password never expires in addition to enabling user object. 66080 - for enabling user...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.