Problem sending email through external mail server.

drew4663

Well-known member
Joined
May 3, 2007
Messages
62
Programming Experience
1-3
I was successful at one point sending mail internally using exchange server. Here is the code I used.....

VB.NET:
Dim message1 As New System.Net.Mail.MailMessage()
        message1.To.Add(tech)
        message1.Subject = tasknumber
        message1.From = New System.Net.Mail.MailAddress("email@server.org")
        message1.Body = issue
        Dim smtp As New System.Net.Mail.SmtpClient("XXX.XX.XX.X")
        smtp.Send(message1)

This worked perfectly for internal but not for external. The office is using Godaddy mail for their email. I don't even know if this is even possible but here is my attempt......which isn't working.

VB.NET:
    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click

        Dim tech As String
        Dim tech1 As String
        tech1 = txtemailto1.Text

        tech = tech1

        Dim message1 As New System.Net.Mail.MailMessage()
        message1.To.Add(tech)
        message1.Subject = (RequestIDTextBox.Text)
        message1.From = New System.Net.Mail.MailAddress("email@server.com")
        message1.Body = IssueTextBox.Text
        Dim smtpout As String
        smtpout = "smtpout.secureserver.net"
        Dim smtpport As Integer
        smtpport = 25
        Dim userName As String
        userName = "johndoe"
        Dim password As String
        password = "password"
        Dim smtpauth As New System.Net.NetworkCredential(userName, password)
        Dim smtp As New System.Net.Mail.SmtpClient(smtpout, smtpport)
        smtp.Send(message1)
    End Sub

You may laugh when you see what I've done here because I am not a pro by any means and I am a real beginner. So, if there is something that doesn't look right it's because I don't know any better. :p


Here is the error message I keep getting:

SmtpFailedRecipientException
Mailbox name not allowed. The server response was: Sorry, that domain isn't in my list of allowed rcpthosts.


Any help would be greatly appreciated. Thanks.
 
Second Fail

VB.NET:
    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        Dim message1 As System.Net.Mail.MailMessage
        Dim smtp As New System.Net.Mail.SmtpClient("smtpout.secureserver.net", 25)
        message1 = New System.Net.Mail.MailMessage(EmailTextBox.Text, txtemailto1.Text, RequestIDTextBox.Text, IssueTextBox.Text)
        smtp.EnableSsl = True
        smtp.Credentials = New System.Net.NetworkCredential("username", "password")
        Try
            smtp.Send(message1)
            MessageBox.Show("Well, the mail message appears to have been a success!", " Successful?", MessageBoxButtons.OK, MessageBoxIcon.Information)
        Catch exc As Net.Mail.SmtpException
            MessageBox.Show(exc.StatusCode.ToString, " Something Happened?", MessageBoxButtons.OK, MessageBoxIcon.Error)
        End Try
    End Sub


Keeping getting a "General Failure" warning on this one. I thought I might also mention that I am using Vista which I heard has problems sending smtp because they didn't include it.
 
Last edited:
VB.NET:
Dim message1 As New System.Net.Mail.MailMessage()
message1.To.Add(tech)
message1.Subject = (RequestIDTextBox.Text)
message1.From = New System.Net.Mail.MailAddress("email@server.com")
message1.Body = IssueTextBox.Text
Dim smtp As New System.Net.Mail.SmtpClient("relay-hosting.secureserver.net", 25)
smtp.Send(message1)

Try this!
 
I tried your code and I did get a different response sort of. I used port 25 first and it gave me this error:

VB.NET:
Mailbox name not allowed. The server response was: sorry, relaying denied from your location [XX.XXX.XX.XXX] (#5.7.1)

My external IP address is where the X's are.

I then tried port 3535 and 80 as suggested by godaddy. I got this repsonse:

VB.NET:
Failure sending mail.

I think that the first error message means that charter cable is blocking my port 25. It gives the error message immediately. When I plug in the other ports it takes much longer as if it is looking for credentials. Any ideas how to apply th credentials correctly?
 
Back
Top