I have the following CGI script that sends email using via SMTP. Now, my script is not sending emails, but what I noticed is that it is only sending emails to my domain (not to any other domain). I have a feeling that the header information provided by the script is not enough or some other issues. Please help me. sub email { my %contact = @_; chomp($contact{'To'}); if ($enablemail == "1") { my $em_header = get_setting_2("em_header"); my $em_footer = get_setting_2("em_footer"); $contact{'Body'} = qq|$em_header $contact{'Body'} \n\n $em_footer|; $statement = 'SELECT * FROM perlDesk_em_forwarders WHERE address = ?'; $sth = $dbh->prepare($statement) or die "Couldnt prepare statement: $DBI::errstr; stopped"; $sth->execute( $contact{'To'} ) or die "Couldn't execute statement: $DBI::errstr; stopped"; my $skip_send = 1 if $sth->rows > 0; if (!$skip_send) { if (get_setting_2("use_smtp")) { use Mail::Sender; my $smtp_address = get_setting_2("smtp_address"); my $smtp_port = get_setting_2("smtp_port"); $sender = new Mail::Sender { smtp => $smtp_address, from => $contact{'From'} }; $sender->MailMsg( { to => $contact{'To'}, subject => $contact{'Subject'}, msg => $contact{'Body'} }); $sender->Close; } else { open(MAIL, "|$global{'sendmail'} -t") || die "Unable to send mail: $!"; print MAIL "To: $contact{'To'}\n"; print MAIL "Cc: $contact{'Cc'}\n" if $contact{'Cc'}; print MAIL "From: $contact{'From'}\n"; print MAIL "Subject: $contact{'Subject'}\n\n"; print MAIL "$contact{'Body'}\n"; close(MAIL); } } } } PHP: