I'm trying to send an e-mail by using Powershell and GMail, and for now, I managed to do so with this function:
function sendMail{
$EmailFrom = “[email protected]”
$EmailTo = “[email protected]”
$Subject = “Subject”
$Body = “Hellow”
$SMTPServer = “smtp.gmail.com”
$SMTPClient = New-Object Net.Mail.SmtpClient($SmtpServer, 587)
$SMTPClient.EnableSsl = $true
$SMTPClient.Credentials = New-Object System.Net.NetworkCredential(“username”, “password”);
$SMTPClient.Send($EmailFrom, $EmailTo, $Subject, $Body)
Write-Host "All done!"
}
And this script works just fine if it wasn't the fact we are using a Proxy within our network. How can I modify this function in order to be able to send e-mails in combination with the Proxy.
In other words, how can I connect to the Proxy and send an e-mail by using an external SMTP server.
HTTP and HTTPS proxies don't allow SMTP connections to pass through them.
If you are using a SOCKS proxy, then you can tunnel all your TCP connections through it including SMTP connections which uses TCP.
You can then use WideCap to socksify all the applications or you can use Component pro .Net SMTP client which supports proxy
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With