Smart questions
Smart answers
Smart people
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Member Login

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips now!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

Join Tek-Tips
*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

LINK TO THIS FORUM!

Add Stickiness To Your Site By Linking To This Professionally Managed Technical Forum.
Just copy and paste the
code below into your site.

Partner With Us!

"Best Of Breed" Forums Add Stickiness To Your Site
Partner Button
(Download This Button Today!)

Feedback

"...I've gotten solutions within a day - it saved a lot of time and actually got me one ATTABOY from my boss..."

Geography

Where in the world do Tek-Tips members come from?

Problem sending text message through emailHelpful Member! 

sjulian (Programmer)
1 Jun 12 13:22
My Visual Basic 2010 application needs to send a text message to three phones under certain conditions.
Written and tested on a Win7 machine it works fine.
After installing on the production machine, a Win Server 2003, the following error occurs:
"5 Mailbox unavailable. The server response was: 5.7.1 <3175551212@messaging.sprintpcs.com>... Relaying denied in sbSendEmail" (number in address changed for security purposes)
Same error occurs when sending to a Verizon account.
If I substitute a standard email address, i.e. email@company.com the email goes through.
My "systems guy" assures me that there is nothing in the firewall that would block one email and not another. Could there be a OS setting that is affecting this?
Here is the block of code used to send the email:

CODE

Imports System.Net.Mail Imports System.Net Private Sub sbSendEmail(ByVal msgText As String) Dim ErrMsg As String = "" Dim fEmail As Integer Dim strAddTemp As String = "" On Error GoTo sbsendemail_errortrap fEmail = FreeFile() FileOpen(fEmail, Application.StartupPath & "\emailaddresses.txt", OpenMode.Input) Dim smtpServer As New SmtpClient("mail.company.com") Dim mail As New MailMessage mail.From = New MailAddress("name@company.com") Do Until EOF(fEmail) Input(fEmail, strAddTemp) mail.To.Add(strAddTemp) Loop FileClose(fEmail) mail.Subject = "IMS db Problem" mail.Body = msgText mail.Priority = MailPriority.High smtpServer.Port = 25 smtpServer.EnableSsl = False smtpServer.Credentials = New NetworkCredential("name@company.com", "password") smtpServer.Send(mail) sbLogEntry("Email Sent", msgText) On Error GoTo 0 Exit Sub sbsendemail_errortrap: ErrMsg = Err.Number & " " & Err.Description & " in sbSendEmail" sbLogEntry(ErrMsg, "") Resume Next End Sub
Borvik (Programmer)
1 Jun 12 13:28
Most likely the server you are using to send the email is configured to allow your computer/account to relay messages to the outside world, and with the program running on a server now (presumably a different user account) the mail server is rejecting the permission to relay to the outside world.

As long as the server handles the domain it is not considered a relay, and it would accept it (which is why email@company.com goes through fine).

If this is indeed the case, your mail server needs to be configured to allow the server you are running your app on permission to relay and/or have your application specify credentials to the mail server.
Qik3Coder (Programmer)
5 Jun 12 11:56
Are you trying to send emails TO the @sprint address or trying to make it look like it's coming FROM the @sprint addrress?
You're probably going to have to live with the FROM address being some sort of "alerts@yourcompany.com"

Lodlaiden

You've got questions and source code. We want both!
Oh? That? That's not an important password. - IT Security Admin (pw on whiteboard)

sjulian (Programmer)
5 Jun 12 12:36
Trying to send FROM a regular email TO the sprint and verizion addresses.
Made a workaround by sending message to address that uses Outlook and setting up auto forward.
Works, but I'd prefer do to it right.
Qik3Coder (Programmer)
5 Jun 12 12:48
It sounds as though you can email the sprint/verizon address from outlook regular without an error. Is that correct?
Can you email ANYONE outside the firewall (external mail) with the account you have set up for the code?

Lodlaiden

You've got questions and source code. We want both!
Oh? That? That's not an important password. - IT Security Admin (pw on whiteboard)

sjulian (Programmer)
5 Jun 12 13:05
Had blinders on . . . just tried another outside email address (not a cell phone text) and it failed with the same error as the text messages.
Helpful Member!  Borvik (Programmer)
5 Jun 12 13:10
Exactly - I've had this issue when trying to send emails.

My development machine worked fine, but another client failed.

Make sure that the code you are using is authenticating with the mail server as a user AUTHORIZED to relay.

OR

In the Exchange Management Console (we use 2010 so it may be different for you) under "Server Configuration" > "Hub Transport" > "Receive Connectors" make sure that the target machine is allowed to relay messages. For us we have created a Connector just for this purpose with only TLS Authentication and Externally Secured - specifying the IP addresses that are allowed to do this (preventing the outside world from relaying).
sjulian (Programmer)
5 Jun 12 13:39
I showed this to my systems guy and he said it makes sense, but right now it isn't worth it to try to get our mail server administrators to make any changes. Since the workaround is working, we'll just leave it as is.
Thanks to Borvik and Qik3Coder!

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close