Click here to Skip to main content
15,881,413 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,

I am trying to retrieve mail addresses from a file and storing each of them in a variable. I wish to send mail to these email addresses using perl. I am using senditquiet for that purpose. But doing it in perl I am using the system command. But it shows the below error:

The specified string is not in the form required for an e-mail address.

system('senditquiet -s smtp.gmail.com -port 587 -u myMailId@gmail.com -p my_password -f mail_id@gmail.com -t $mail_id@gmail.com -protocol ssl -files C:\ComboFix.txt');

where $mail_id is the variable where I am storing the mail address.

I even tries the below two statements still the error does not go off.

1. system("senditquiet -s smtp.gmail.com -port 587 -u myMailId@gmail.com -p my_password -f mail_id/@gmail.com -t $mail_id@gmail.com -protocol ssl -files C:\ComboFix.txt");
N.B. : Please mark that here I am using the double quotes and also I put the '\' sign before @ symbol.

2. system('senditquiet -s smtp.gmail.com -port 587 -u myMailId@gmail.com -p my_password -f mail_id@gmail.com -t $mail_id@gmail.com -protocol ssl -files C:\ComboFix.txt');
N.B. Please note that I am using the single quotes here.

Please help me someone.

Thanks
Posted

1 solution

senditquiet -s smtp.gmail.com -port 587 -u myMailId@gmail.com -p my_password -f mail_id/@gmail.com -t $mail_id@gmail.com -protocol ssl -files C:\ComboFix.txt


There are all sorts of special characters in that.
And a variable that you want to resolve.

Because of the latter - you MUST use double quotes.
But because of that you must escape the specials: @ \

And for testing you need to use the following form.

my $cmd = "senditquiet -s...";
print "$cmd\n";
system($cmd);

Then it will print the command that you are trying to process and you can try that in a console by coping it from the console and running it yourself.

Additional notes
- Presumably you are checking the return value of system for errors.
- You should be using "use strict;" at the top of your perl script.
- You should be running perl with "perl -w ..."

The latter two items should show errors.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900