How do you send an email through port 80? - vbscript

I'm trying to make a vbs code that e-mails some text but the network here is blocking port 25 is there a way of doing this through port 80 or some way to send a message through port 80 at least.
I got this error code when I tried: 80040213
Here is my code:
dim strSMTPFrom, strSMTPTo, strSMTPRelay, strTextBody, strSubject, oMessage
strSMTPFrom = "email#gmail.com"
strSMTPTo = "email#gmail.com"
strSMTPRelay = "smtp-relay.gmail.com"
strTextBody = "test"
strSubject = "test"
Set oMessage = CreateObject("CDO.Message")
oMessage.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configurati on/sendusing") = 2
oMessage.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpserver") = strSMTPRelay
oMessage.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configurati on/smtpserverport") = 25
oMessage.Configuration.Fields.Update
oMessage.Subject = strSubject
oMessage.From = strSMTPFrom
oMessage.To = strSMTPTo
oMessage.TextBody = strTextBody
oMessage.Send

Nowadays most ISPs block outgoing connections to port 25 in an attempt to fight botnet spam. There are 2 customary ways of dealing with this:
Send the mail through the ISP's mail servers (if the ISP provides a mail gateway for its customers).
Send the mail to a mail submission server hosted by yourself or your mail provider via an (authenticated) connection to port 587 (submission) or port 465 (smtps, deprecated).
Technically you can send mail via port 80 if you set up a mail server that accepts mail on that port. Doing so isn't common (or recommended) practice, though.

Related

Fetch emails through IMAP with proxy of form user:password:host:port

I have code to login to my email account to fetch recent emails:
def fetchRecentEmail(emailAddr, emailPassword, timeout=120):
host = fetch_imap_server(emailAddr) # e.g. 'outlook.office365.com'
with IMAP4_SSL(host) as session:
status, _ = session.login(emailAddr, emailPassword)
if status == 'OK':
# fetch most recent message
status, messageData = session.select("Inbox")
:
I'm trying to tweak it to go through a proxy.
ref: How can I fetch emails via POP or IMAP through a proxy?
ref: https://gist.github.com/sstevan/efccf3d5d3e73039c21aa848353ff52f
In each of the above resources, the proxy is of clean form IP:PORT.
However my proxy is of the form USER:PASS:HOST:PORT.
The proxy works:
USER = 'Pp7fwti5n-res-any-sid-' + random8Digits()
PASS = 'abEDxts7v'
HOST = 'gw.proxy.rainproxy.io'
PORT = 5959
proxy = f'{USER}:{PASS}#{HOST}:{PORT}'
proxies = {
'http': 'http://' + proxy,
'https': 'http://' + proxy
}
response = requests.get(
'https://ip.nf/me.json',
proxies=proxies, timeout=15
)
The following code looks like it should work, but errors:
HOST = 'outlook.office365.com'
IMAP_PORT = 963
PROXY_TYPE = 'http' # rainproxies are HTTP
mailbox = SocksIMAP4SSL(
host=HOST,
port=IMAP_PORT,
proxy_type=PROXY_TYPE,
proxy_addr=URL,
proxy_port=PORT,
username=USER,
password=PASS
)
emailAddress, emailPassword = EMAIL.split(',')
mailbox.login(emailAddress, emailPassword)
typ, data = mailbox.list()
print(typ)
print(data)
I needed to add a timeout arg/param in 2 places to get the code to run:
def _create_socket(self, timeout=None):
sock = SocksIMAP4._create_socket(self, timeout)
server_hostname = self.host if ssl.HAS_SNI else None
return self.ssl_context.wrap_socket(
sock, server_hostname=server_hostname
)
def open(self, host='', port=IMAP4_PORT, timeout=None):
SocksIMAP4.open(self, host, port, timeout)
Rather confusing that nobody else seems to have flagged that in the gist.
But it still won't work.
If I use any number other than 443 for IMAP_PORT I get this error:
GeneralProxyError: Socket error: 403: Forbidden
[*] Note: The HTTP proxy server may not be supported by PySocks (must be a CONNECT tunnel proxy)
And if I use 443, while I now get no error, mailbox = SocksIMAP4SSL( never completes.
So I am still far from a working solution.
I am hoping to run this code simultaneously on 2 CPU cores, so I don't understand the implications of using port 443. Is that going to mean that no other process on my system can use that port? And if this code is using this port simultaneously in two processes, does this mean that there will be a conflict?
Maybe you can try monkeypatching socket.socket with PySocket.
import socket
import socks
socks.set_default_proxy(socks.SOCKS5, HOST, PORT, True, USER, PASS)
socket.socket = socks.socksocket
Then check if your IMAP traffic is going through a given proxy.

Sending an email over TLS

I've try send email using TLS and port number is 587 with server name is smtp.gmail.com but always got error "error '8004020e'". I set SSL to false because the port 587 Authentication is TLS. Any wrong in my code?
Set objMail = Server.CreateObject("CDO.Message")
Set objConfig = CreateObject("CDO.Configuration")
objConfig.Fields("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "smtp.gmail.com"
objConfig.Fields("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 587
objConfig.Fields("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
objConfig.Fields("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = 1
objConfig.Fields("http://schemas.microsoft.com/cdo/configuration/smtpusessl") = false
objConfig.Fields("http://schemas.microsoft.com/cdo/configuration/sendusername") = "xx#gmail.com"
objConfig.Fields("http://schemas.microsoft.com/cdo/configuration/sendpassword") = "xx"
objConfig.Fields("http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout") = 60
objConfig.Fields.Update
Set objMail.Configuration = objConfig
objMail.From = "xx#gmail.com"
objMail.To = "yy#yahoo.com"
objMail.Subject = "Test EMAIL"
objMail.TextBody = "Test EMAIL"
objMail.HTMLBody = "fffffffffff"
objMail.Send
Set objMail = Nothing
Use port 465 instead and use ssl (smtpusessl = True) for Gmail or Amazon SES SMTP.
And also have to make sure (log in to the Gmail account mailbox, check if there are messages, that tell you about previous unsuccessful attempts) that the mailbox usage for the "old applications" are enabled... (it's a new "feature", that can be enabled on Yahoo and Google mail servers since not too long ago... Even maybe some mobile email clients will not work if this is not set.)

Doesn't get Access_accept packet from freeradius server

1.From client:
root#amsys-LIFEBOOK-AH502:/home/amsys# radtest -t chap usr password 127.0.0.1 0 testing123
This is how,the way i sended a packet access-request packet from the client (here,loop back only).
2.From server.
the server responds to client as shown as below:
Ready to process requests.
Ignoring request to auth address * port 1812 as server default from unknown client 127.0.0.1 port 34962 proto udp
3.server to client
Sending Access-Request of id 67 from 0.0.0.0 port 47852 to 127.0.0.1 port 1812
User-Name = 'usr'
User-Password = 'password'
NAS-IP-Address = 127.0.1.1
NAS-Port = 0
Message-Authenticator = 0x00
radclient: no response from server for ID 67 socket 3
if anybody would aware about this thing,please give your prompt response and pleased me.thanking you.!

kannel smpp: unable to get the acknowledgment

I'm working on a project for sending SMS using SMPP protocol and KANNEL.
Everything is working well; the only problem is that I'm still unable to get the acknowledgment, so I can't know if the message was successfully received by the client or if I should send it again.
Please, does anyone have an idea on how I can solve that? Or if there is a tool with a UI that I can use instead of KANNEL?
Here is my config file:
group = core
dlr-storage = internal
admin-port = 13000
admin-password = password
status-password = password
admin-allow-ip = ''
smsbox-port = 13001
log-level = 0
log-file = "/usr/local/kannel/logs/kannel.log"
box-allow-ip = "127.0.0.1"
group = smsbox
smsbox-id = BOX1
bearerbox-host = 127.0.0.1
sendsms-port = 13013
log-file = "usr/local/kannel/logs/smsbox.log"
log-level = 0
access-log = "usr/local/kannel/logs/access.log"
group = sendsms-user
username = user
password = password
group = smsc
smsc = smpp
smsc-id = SMSC1
host = my_host_ip
port = my_host_port
smsc-username = user
smsc-password = password
address-range = ""
system-type = ""
transceiver-mode = true
When sending your message, make sure you have your registered_delivery flag set appropriately.
Add dlr-mask = 31 to "group = sendsms-user"
OR
Using the Kannel HTTP API, set your dlr-mask. For example:
http://localhost:13013/cgi-bin/sendsms?username=tester&password=foobar&to=+12345678910&text=Test&dlr-mask=31
From the Kannel User Guide: "dlr-mask: Optional. Request for delivery reports with the state of the sent message. The value is a bit mask composed of: 1: Delivered to phone, 2: Non-Delivered to Phone, 4: Queued on SMSC, 8: Delivered to SMSC, 16: Non-Delivered to SMSC. Must set dlr-url on sendsms-user group or use the dlr-url CGI variable."

CDO.Message.1 error '80040213' with Google Address

Been having an issue trying to move our ASP page CDO over to gmail. It's about to drive me crazy. I've done some exhaustive searching and I think my code is right but I still get the dreaded: CDO.Message.1 error '80040213' The transport failed to connect to the server. on oMail.Send. Any thoughts would be much appreciated. I'm beginning to think it may be a server firewall issue.
Const cdoSendUsingPickup = 1
Const cdoSendUsingPort = 2
Const cdoAnonymous = 0
Const cdoBasic = 1
Const cdoNTLM = 2
Set oMail = CreateObject("CDO.Message")
oMail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
oMail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "smtp.gmail.com"
oMail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = cdoBasic
oMail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/sendusername") = "info#domain.com"
oMail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/sendpassword") = "password"
oMail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 465
oMail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpusessl") = True
oMail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout") = 60
oMail.From = "info#domain.com"
oMail.To = "someone#domain.com"
oMail.Bcc = ""
'oMail.To = ""
oMail.Subject = ""
oMail.HTMLBody = "<font size='2' face='Verdana, Arial, Helvetica, sans-serif'>"
oMail.HTMLBody = oMail.HTMLBody + "Name: <b>"& request.form("Name")&"</b><br>"
oMail.HTMLBody = oMail.HTMLBody + "Phone: <b>"& request.form("Phone")&"</b><br>"
oMail.HTMLBody = oMail.HTMLBody + "Email: <b>"& request.form("Email")&"</b><br>"
oMail.HTMLBody = oMail.HTMLBody + "Best Time to Call: <b>"& request.form("BestTime")&"</b><br>"
oMail.HTMLBody = oMail.HTMLBody + "Question/Comment: <b>"& request.form("Comment")&"</b><br>"
oMail.HTMLBody = oMail.HTMLBody + "</font>"
oMail.Configuration.Fields.Update
oMail.Send
Set oMail = Nothing
Set oMailConfig = Nothing
Any thoughts or suggestions would be much appreciated. I've tried all the Google smtp ports 25,465, and 567. What am I missing?
Straight from Google's own instructions;
Standard configuration instructions:
Incoming Mail (POP3) Server - requires SSL: pop.gmail.com
Use SSL: Yes
Port: 995
Outgoing Mail (SMTP) Server - requires TLS or SSL: smtp.gmail.com
Use Authentication: Yes
Port for TLS/STARTTLS: 587
Port for SSL: 465
Server timeouts Greater than 1 minute, we recommend 5
Full Name or Display Name: [your name]
Account Name or User Name: your full email address (including #gmail.com or #your_domain.com)
Email Address: your email address (username#gmail.com or username#your_domain.com)
Password: your Gmail password
I would also check your server has dns resolution to smtp.gmail.com and check your firewall which maybe blocking port 465, as a test try connecting without SSL to see if you can connect on 25 (see this article - Unable to send emails using gmail smtp server
Suggestion for google:
If you're having trouble sending mail but you've confirmed that encryption is active for SMTP in your mail client, try to configure your SMTP server on a different port (465 or 587).

Resources