Sending Emails in VB.net

Permit2kill

Member
Joined
Jun 25, 2007
Messages
21
Programming Experience
Beginner
I hope this is the right section, if not I apologize :(

Anyways, basically I've been trying to set up a program that sends emails to my email: jdude77@hotmail.com

I've been trying to use the System.Net.Mail resource and then using the SMTPClient class to send my mail.
The problems I'm running into is when I go to send the mail I get an error message reading "Failure sending mail".

I'm trying to use someone else's SMTP server, and I'm not even sure if this is allowed. If not, is there anyway at all that I can use someone else's SMTP server (ie. gmail or hotmail's) to send mails?

My code is:

VB.NET:
Imports System.Net.Mail

Public Class Form1
    Private Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click
        Dim Test As New SmtpClient
        Test.Host = "209.85.199.111"
        Test.Send("jdude77@hotmail.com", "jdude77@hotmail.com", "Test Email", "This is a test email")
    End Sub
End Class
The IP address (209,85.199.111) is from smtp.gmail.com.
 
I'm trying to use someone else's SMTP server, and I'm not even sure if this is allowed. If not, is there anyway at all that I can use someone else's SMTP server.
SMTP servers normally only allow senders from within their own networks (ip filter), or require user account login (authentication) to send.
 
You can do that, you can also use the one provided by your ISP, unless you had other purpose in mind.
 
Yeah it looks like my ISP blocks all outgoing emails coming from port 25 so setting up my own server seems to be out of the option. It looks like I'll have to figure out how to use their SMTP service.
Do you know how I'd find out if their server is open relay or not?
 
What do you mean actually? Are you saying you can't figure out how to send email with your ISP? They have instructions for this both online and with the account papers you got when signing up. Port 25 is SMTP servers incomming port, by the way.
 
In an effort to reduce the volume of Unsolicited Bulk Email (SPAM), any outbound traffic on Port 25 that is not directed toward a Shaw Email Server is blocked.
So basically what I'm getting from this is that any server I set up on my computer can't be used because my ISP blocks outbound traffic.
 
That could be, when you send mail it is coming from any open port at your machine and targets any SMTP servers port 25, so they can detect where traffic from you is headed and stop it if it's not going their way. But you can use the address they have given you to send mail, right?
 
Yeah, it turns out I should have tried that in the beginning, it would have saved me a fair bit of trouble. Anyways, it works now that I'm using their server. Thanks for the help :)
 
Back
Top