"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "DADA/Mail/Send.pm" between
dada-11_14_1.tar.gz and dada-11_14_2.tar.gz

About: Dada is a web-based electronic (mass) mailing list management system.

Send.pm  (dada-11_14_1):Send.pm  (dada-11_14_2)
skipping to change at line 367 skipping to change at line 367
my $host; my $host;
if ( $self->{ls}->param('set_smtp_sender') == 1 ) { if ( $self->{ls}->param('set_smtp_sender') == 1 ) {
$host = $self->{ls}->param('admin_email'); $host = $self->{ls}->param('admin_email');
} }
else { else {
$host = $self->{ls}->param('list_owner_email'); $host = $self->{ls}->param('list_owner_email');
} }
$host =~ s/(.*?)\@//; $host =~ s/(.*?)\@//;
try { my $smtp_obj;
if ( defined( $self->net_smtp_obj ) && $self->im_mass_sending == 1 )
{ # If it's defined, let's use it;
warn 'Reusing Net::SMTP object...'
if $t;
$smtp_obj = $self->net_smtp_obj;
}
else {
my $smtp_obj; my $smtp_params = {
hello => $host,
host => $self->{ls}->param('smtp_server'),
port => $self->{ls}->param('smtp_port'),
ssl => $self->{ls}->param('use_smtp_s
sl'),
starttls => $self->{ls}->param('smtp_start
tls'),
ssl_verify_mode => $self->{ls}->param('smtp_ssl_v
erify_mode'),
};
if ( defined( $self->net_smtp_obj ) && $self->im_mass_sending == 1 ) if($self->{ls}->param('use_sasl_smtp_auth') == 1){
{ # If it's defined, let's use it;
warn 'Reusing Net::SMTP object...'
if $t;
$smtp_obj = $self->net_smtp_obj;
}
else {
my $smtp_params = { $smtp_params->{username} = $self->{ls}
hello => $host, ->param('sasl_smtp_username');
host => $self->{ls}->param('smtp_server'), $smtp_params->{password} = $self->_cip
port => $self->{ls}->param('smtp_port'), her_decrypt(
ssl => $self->{ls}->param('us
e_smtp_ssl'), $self->{ls}->param('sasl_smtp_password')
starttls => $self->{ls}->param('sm
tp_starttls'), );
ssl_verify_mode => $self->{ls}->param('sm $smtp_params->{sasl_auth_mechanism} = $self->{ls}
tp_ssl_verify_mode'), ->param('sasl_auth_mechanism');
}; }
if($self->{ls}->param('use_sasl_smtp_auth') == 1)
{
$smtp_params->{username} = $se
lf->{ls}->param('sasl_smtp_username');
$smtp_params->{password} = $se
lf->_cipher_decrypt(
$self->{ls}->param('sasl_smtp_pas
sword')
);
$smtp_params->{sasl_auth_mechanism} = $se
lf->{ls}->param('sasl_auth_mechanism');
}
require DADA::App::SMTPTools;
my $smtp_status = 0;
my $smtp_r = undef;
($smtp_status, $smtp_r, $smtp_obj) = DADA::App::S
MTPTools::smtp_obj($smtp_params);
if($smtp_status == 0){
carp "Problems sending via SMTP:" . $smtp_r;
return -1;
}
} require DADA::App::SMTPTools;
my $smtp_status = 0;
my $smtp_r = undef;
warn 'creating net_smtp_obj'
if $t;
($smtp_status, $smtp_r, $smtp_obj) = DADA::App::SMTPTools
::smtp_obj($smtp_params);
if($smtp_status == 0){
carp "Problems sending via SMTP:" . $smtp_r;
return -1;
}
else {
warn 'net_smtp_obj created.'
if $t;
}
}
if ( $self->im_mass_sending == 1 ) {
warn 'Saving Net::SMTP Object for re-use' warn 'Saving Net::SMTP Object for re-use'
if $t; if $t;
$self->net_smtp_obj($smtp_obj);
}
if ( $self->im_mass_sending == 1 ) { my $to;
$self->net_smtp_obj($smtp_obj); if (
} $self->{ls}->param('group_list') == 1
&& $fields{from_mass_send} == 1
&& defined(
$self->{ls}->param('discussion_pop_email') ) # safegaurd?
my $to; )
if ( {
$self->{ls}->param('group_list') == 1 # This is who it's going to.
&& $fields{from_mass_send} == 1 $to = $fields{To};
&& defined(
$self->{ls}->param('discussion_pop_email') ) # safegaurd?
) require DADA::App::FormatMessages;
{ my $fm = DADA::App::FormatMessages->new(
# This is who it's going to. -List => $self->{list},
$to = $fields{To}; -ls_obj => $self->{ls},
);
require Email::Address;
require DADA::App::FormatMessages; my $formatted_disc_email = $fm->_encode_header(
my $fm = DADA::App::FormatMessages->new( 'To',
-List => $self->{list}, $fm->format_phrase_address(
-ls_obj => $self->{ls}, $self->{ls}->param('list_name'),
); $self->{ls}->param('discussion_pop_email')
require Email::Address; )
);
my $formatted_disc_email = $fm->_encode_header(
'To',
$fm->format_phrase_address(
$self->{ls}->param('list_name'),
$self->{ls}->param('discussion_pop_email')
)
);
# This is what we're going to say we are... # This is what we're going to say we are...
$fields{To} = $formatted_disc_email; $fields{To} = $formatted_disc_email;
if ( $self->{ls}->param('set_to_header_to_list_address') == 1 ) if ( $self->{ls}->param('set_to_header_to_list_address') == 1 )
{ {
# Nothin' needed. # Nothin' needed.
}
else {
# Uh, unless it's a list invitation we're sending - why would we want
# replies from a non-subscriber posting to the list?
if ( $self->list_type ne 'invite_list' ) {
# This goes against RFC
$fields{'Reply-To'} = $formatted_disc_email;
}
}
} }
else { else {
# um, nevermind. # Uh, unless it's a list invitation we're sending - why would we want
$to = $fields{To}; # replies from a non-subscriber posting to the list?
if ( $self->list_type ne 'invite_list' ) {
# This goes against RFC
$fields{'Reply-To'} = $formatted_disc_email;
}
} }
}
else {
# um, nevermind.
$to = $fields{To};
# why wouldn't it be defined? }
if ( defined($to) ) {
;
eval { $to = ( Email_Address_parse($to) )[0]->address; };
}
my $smtp_msg = ''; # why wouldn't it be defined?
for my $field (@default_headers) { if ( defined($to) ) {
$smtp_msg .= "$field: $fields{$field}\n" ;
if ( ( defined $fields{$field} ) eval { $to = ( Email_Address_parse($to) )[0]->address; };
&& ( $fields{$field} ne "" ) ); }
}
$smtp_msg .= "\n";
$smtp_msg .= $fields{Body} . "\n";
my $FROM_error_flag = 0; my $smtp_msg = '';
my $FROM_error = "problems sending FROM:<> command to SMTP server."; for my $field (@default_headers) {
$smtp_msg .= "$field: $fields{$field}\n"
if ( ( defined $fields{$field} )
&& ( $fields{$field} ne "" ) );
}
$smtp_msg .= "\n";
$smtp_msg .= $fields{Body} . "\n";
if ( $self->{ls}->param('set_smtp_sender') == 1 ) { my $FROM_error_flag = 0;
if ( $self->{ls}->param('verp_return_path') ) { my $FROM_error = "problems sending FROM:<> command to SMTP server.";
if ( !$smtp_obj->mail( $self->_verp($to) ) ) {
carp $FROM_error; if ( $self->{ls}->param('set_smtp_sender') == 1 ) {
$FROM_error_flag++; if ( $self->{ls}->param('verp_return_path') ) {
} if ( !$smtp_obj->mail( $self->_verp($to) ) ) {
} carp $FROM_error;
else { $FROM_error_flag++;
if ( !$smtp_obj->mail( $self->{ls}->param('admin_email') ) )
{
carp $FROM_error;
$FROM_error_flag++;
}
} }
} }
else { else {
if ( $self->{ls}->param('verp_return_path') ) { if ( !$smtp_obj->mail( $self->{ls}->param('admin_email') ) ) {
if ( !$smtp_obj->mail( $self->_verp($to) ) ) { carp $FROM_error;
carp $FROM_error; $FROM_error_flag++;
$FROM_error_flag++;
}
} }
else { }
if ( }
!$smtp_obj->mail( else {
$self->{ls}->param('list_owner_email') if ( $self->{ls}->param('verp_return_path') ) {
) if ( !$smtp_obj->mail( $self->_verp($to) ) ) {
) carp $FROM_error;
{ $FROM_error_flag++;
carp $FROM_error;
$FROM_error_flag++;
}
} }
} }
else {
if (
!$smtp_obj->mail(
$self->{ls}->param('list_owner_email')
)
)
{
carp $FROM_error;
$FROM_error_flag++;
}
}
}
if ( !$FROM_error_flag ) { if ( !$FROM_error_flag ) {
if ( $smtp_obj->to($to) ) { if ( $smtp_obj->to($to) ) {
if ( $smtp_obj->data ) { if ( $smtp_obj->data ) {
if ( $smtp_obj->datasend($smtp_msg) ) { if ( $smtp_obj->datasend($smtp_msg) ) {
if ( $smtp_obj->dataend ) { if ( $smtp_obj->dataend ) {
# oh hey, everything worked! # oh hey, everything worked!
}
else {
carp "problems completing sending message to SMT
P server. (dataend): " . $smtp_obj->message();
$smtp_obj->reset(
);
return -1;
}
} }
else { else {
carp "problems sending message to SMTP server. (data send): " . $smtp_obj->message(); carp "problems completing sending message to SMTP se rver. (dataend): " . $smtp_obj->message();
$smtp_obj->reset(); $smtp_obj->reset();
return -1; return -1;
} }
} }
else { else {
carp "problems sending DATA command to SMTP server. (dat a): " . $smtp_obj->message(); carp "problems sending message to SMTP server. (datasend ): " . $smtp_obj->message();
$smtp_obj->reset(); $smtp_obj->reset();
return -1; return -1;
} }
} }
else { else {
carp "problems sending '" . $to carp "problems sending DATA command to SMTP server. (data):
. "' in 'RCPT TO:<>' command to SMTP server: " . $smtp_obj " . $smtp_obj->message();
->message(); $smtp_obj->reset();
$smtp_obj->reset(); return -1;
return -1;
} }
} }
else { else {
carp $FROM_error; carp "problems sending '" . $to
$smtp_obj->reset(); . "' in 'RCPT TO:<>' command to SMTP server: " . $smtp_obj->me
return -1; ssage();
$smtp_obj->reset();
return -1;
} }
}
my $reset_problem = 0; else {
$smtp_obj->reset() or $reset_problem = 1; carp $FROM_error;
$smtp_obj->reset();
if ( $self->{ls}->param('smtp_connection_per_batch') != 1 || $reset_ return -1;
problem == 1) { }
$smtp_obj->quit my $reset_problem = 0;
or carp "problems 'QUIT'ing SMTP server."; $smtp_obj->reset() or $reset_problem = 1;
$self->net_smtp_obj(undef);
if ( $self->{ls}->param('smtp_connection_per_batch') != 1 || $reset_prob
if($reset_problem == 1) { lem == 1) {
warn 'Purging Net::SMTP object, after reset error.'; $smtp_obj->quit
} or carp "problems 'QUIT'ing SMTP server.";
else { warn 'undefining net_smtp_obj'
warn 'Purging Net::SMTP object, since we reconnect for ea if $t;
ch message' $self->net_smtp_obj(undef);
if $t;
} if($reset_problem == 1) {
} warn 'Purging Net::SMTP object, after reset error.'
if $t
} catch { # end of the eval block. }
carp "Problems sending via SMTP: $_"; else {
return -1; warn 'Purging Net::SMTP object, since we reconnect for each mess
}; age'
if $t;
}
}
} }
elsif ( $self->{ls}->param('sending_method') eq 'sendmail' ) { elsif ( $self->{ls}->param('sending_method') eq 'sendmail' ) {
my $live_mailing_settings; my $live_mailing_settings;
# carp ' $fields{To} ' . $fields{To}; # carp ' $fields{To} ' . $fields{To};
my $plain_to_address = $fields{To}; #holds something like, me@you.com my $plain_to_address = $fields{To}; #holds something like, me@you.com
if ( defined($plain_to_address) ) { if ( defined($plain_to_address) ) {
skipping to change at line 825 skipping to change at line 825
} }
else { else {
die 'Unknown Sending Method: "' die 'Unknown Sending Method: "'
. $self->{ls}->param('sending_method') . '"'; . $self->{ls}->param('sending_method') . '"';
} }
$self->{mj_log}->mj_log( $self->{ls}->param('list'), $self->{mj_log}->mj_log( $self->{ls}->param('list'),
'Mail Sent', "Recipient:$recipient_for_log, Subject:$fields{Subject}" ) 'Mail Sent', "Recipient:$recipient_for_log, Subject:$fields{Subject}" )
if $DADA::Config::LOG{mailings}; if $DADA::Config::LOG{mailings};
warn 'literally returning 1' if $t;
return 1; return 1;
} }
sub _mail_merge_vars_from_entity { sub _mail_merge_vars_from_entity {
my $self = shift; my $self = shift;
my $entity = shift; my $entity = shift;
require DADA::App::FormatMessages; require DADA::App::FormatMessages;
my $fm = DADA::App::FormatMessages->new( my $fm = DADA::App::FormatMessages->new(
 End of changes. 30 change blocks. 
186 lines changed or deleted 183 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)