ZConf-Mail

 view release on metacpan or  search on metacpan

bin/zcmailaccount  view on Meta::CPAN

		if (defined($args{pass})) {
			$ini=$ini.$args{pass};
		}
		$ini=$ini."\n\n".
		"; useSSL: A boolean value indicating wether SSL should be used or not.\n".
		"; 0 = false     1 = true\n".
		"useSSL=";
		if (defined($args{useSSL})) {
			$ini=$ini.$args{useSSL};
		}else {
			$ini=$ini."0";
		}
		$ini=$ini."\n\n".
		"; name: The name for use with this account.\n".
		"name=";
		if (defined($args{name})) {
			$ini=$ini.$args{name};
		}
		$ini=$ini."\n\n".
		"; from: The from address for this account.\n".
		"from=";
		if (defined($args{from})) {
			$ini=$ini.$args{from};
		}
		$ini=$ini."\n\n".
		"; saveTo: The account to save the message to post sending.\n".
		"; example: saveTo=imap/whatever\n".
		"saveTo=";
		if (defined($args{saveTo})) {
			$ini=$ini.$args{saveTo};
		}
		$ini=$ini."\n\n".
		"; saveToFolder: The folder to save to.\n".
		"; example: saveToFolder=Sent\n".
		"saveToFolder=";
		if (defined($args{saveToFolder})) {
			$ini=$ini.$args{saveToFolder};
		}else {
			$ini=$ini."Sent";
		}
		$ini=$ini."\n\n".
		"; usePGP: Where or not PGP should be used or not. This is a boolean value.\n".
		"; 0 = false    1 = true\n".
		"usePGP=";
		if (defined($args{usePGP})) {
			$ini=$ini.$args{usePGP};
		}else {
			$ini=$ini."0";
		}
		$ini=$ini."\n\n".
		"; pgpType: The signing type for the message.\n".
		"; clearsign: Clear sign the message.\n".
		"; mimesign: Attach the signature as a attachment.\n".
		"pgpType=";
		if (defined($args{pgpType})) {
			$ini=$ini.$args{pgpType};
		}else {
			$ini=$ini."clearsign";
		}
		$ini=$ini."\n\n".
		"; PGPkey: The PGP to use. A list can be found using 'gpg -K'.\n".
		"PGPkey=";
		if (defined($args{PGPkey})) {
			$ini=$ini.$args{PGPkey};
		}
		$ini=$ini."\n\n".
		"; PGPdigestAlgo: The digest algorithym to use.\n".
		"; To find what out what your version supports, run 'gpg --version'.\n".
		"PGPdigestAlgo=";
		if (defined($args{PGPdigestAlgo})) {
			$ini=$ini.$args{PGPdigestAlgo};
		}
		$ini=$ini."\n";
		
		return $ini;
	}

	
	#account type was not matched
	return undef;
}

#breaks it down from $ini->{_}
sub iniTOargs{
	my $raw=$_[0];
	
	my $ini=Config::Tiny->read_string($raw);

	my @keys=keys(%{ $ini->{_} });

	my %args;
	my $int=0;
	while (defined( $keys[$int] )) {
		$args{ $keys[$int] }=$ini->{_}->{ $keys[$int] };
		$int++;
	}

	return %args;
}

#gets the options
my %opts=();
getopts('a:A:z:s:f:', \%opts);
my %args;

#makes sure we have a account specified
if (! defined($opts{a}) ) {
	warn('zcmailaccount: No account, -a, specified');
	exit 254;
}

#make sure we have a action.
if (! defined($opts{A}) ) {
	warn('zcmailaccount: No action, -A, specified');
	exit 254;
}

#makes sure -f points to a file
if (
	(defined($opts{f})) &&
	(! -f $opts{f})
	) {
	warn('zcmailaccount: "'.$opts{f}.'" does not exist or it not a file');
	exit 254;
}

#make sure it is a valid account type
if (



( run in 1.581 second using v1.01-cache-2.11-cpan-df04353d9ac )