How to connect to a mail server as a user (through Tor) and send e-mails from a hidden service webmail in perl?

Tor Asked on December 9, 2021

I have an account with the Tor-based e-mail provider Mail2Tor. Their hidden service has been down lately; therefore I cannot access my e-mail account either to send or receive e-mail. I have been attempting to write a Perl script designed to connect to the mail server (hidden service) so I can send mail. There are two main problems with my configuration: one, I cannot connect it to the mail hidden service, and two, the instructions I read for creation of a mail client was actually for a locally hosted one, not a remote one.

The original code: 

use LWP::UserAgent;
use LWP::Protocol::Socks;

my $url= ""; #your url here
my $ua = new LWP::UserAgent(agent => 'perl');
$ua -> proxy([qw(http https)] => 'socks://');

print "To:n";
$from='';#your email here
print "Subject:n";
print "Body:n";

open(MAIL, "|/usr/sbin/sendmail -t");

print MAIL "To: $ton";
print MAIL "From: $fromn";
print MAIL "Subject: $subjectnn";
print MAIL $message;

print "Email Sent!";

If anyone can help me solve these two problems, I would be quite grateful.

2 Answers

I'm not coding in perl and do not know the behavior of perl, but mainly the executer first tries to resolve the onion address and then add the proxy to the socket.

In java, you should create an unresolved socket which will try to resolve it through SOCKs proxy. You check my answer and code in java, in here.

And if you want your own hidden mail server, maybe my blog post can help you. Configuring a Hidden Email Server

Answered by Mir Saman on December 9, 2021

You need to connect to remote hidden service mail server with SMTP protocol, your example is sending mail via local sendmail. Sending mail using local sendmail is possible only if local sendmail is configured to connect to TOR.

Answered by Radim Kolář on December 9, 2021

Add your own answers!

Related Questions

Vps works over tor

2  Asked on January 6, 2022 by khalid-al-anzi


Purpose of geoip Data file

2  Asked on December 30, 2021


Configuring Tor to Work in Other Web Browsers

2  Asked on December 9, 2021 by statto


Tor gets stuck on “Loading Network Status”

1  Asked on November 27, 2021 by bornad-x


Use Tor as Proxy for Internet

0  Asked on November 22, 2021 by youngtrashbag


Would it be possible to port Tor to Musl libc?

1  Asked on November 10, 2021 by saten-san


Tor Installed on Xubuntu VM: Port/Config Problem?

1  Asked on November 5, 2021 by ex_tenebros


I don’t want to identify myself as a TOR user

2  Asked on September 28, 2021 by parth-savadiya


Can TOR Browser be used with proxychains?

1  Asked on September 28, 2021 by userme


Configure for one hop only

2  Asked on September 28, 2021


Disable Network Set

0  Asked on September 28, 2021 by bandit-poolana


Ask a Question

Get help from others!

© 2023 All rights reserved. Sites we Love: PCI Database, MenuIva, UKBizDB, Menu Kuliner, Sharing RPP, SolveDir