By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
434,587 Members | 1,071 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 434,587 IT Pros & Developers. It's quick & easy.

Problem sending email from Webform

P: n/a
Hello,

I am sending two emails from the same procedure, one to myself (while testing) and another (a comfirmation) to the user on the website.

I was having difficulty finding a relay server to SMTP though, but was able to do this though one of my personal account, Cabbage.Org. It doesn't make any sense to me why this works and no other account, including localhost and the remote server which hosts the website.

Here is a code snippet showing the sending of both emails:

**************************
Dim MailObj As New System.Net.Mail.SmtpClient

MailObj.Host = "smtp.youthkaraoke.org"

MailObj.Send("ma**@dragonimports.com", "ms**@cabbage.org", strSubject, strBody) 'Change ms**@Truckloads.Net to working email

'Send confirmation to sender

strBody = "Thank you for submitting your request to Dragon Importing" + vbNewLine + _

"You will be contacted soon by one of our reprresentives!" + vbNewLine + vbNewLine + _

"The Dragon Importing Staff"

MailObj.Send("ma**@dragonimports.com", txtEmail.Text, "Confirmation", strBody)

*********************************

In the first send, ms**@cabbage.org is the recipient and the letter goes through without a problem. In the second, if the value of txtEmail.Text is ms**@cabbage.org, then no problem either, but if any other email address is used then I get this error:



Server Error in '/' Application.
--------------------------------------------------------------------------------

Syntax error, command unrecognized. The server response was: Unauthorized relay msg rejected
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.Net.Mail.SmtpException: Syntax error, command unrecognized. The server response was: Unauthorized relay msg rejected

Source Error:

Line 79: "You will be contacted soon by one of our reprresentives!" + vbNewLine + vbNewLine + _
Line 80: "The Dragon Importing Staff"
Line 81: MailObj.Send("ma**@dragonimports.com", txtEmail.Text, "Confirmation", strBody)
Line 82:
Line 83:

Source File: C:\Domains\dragonimporting.com\wwwroot\Contact.asp x.vb Line: 81

Stack Trace:

[SmtpException: Syntax error, command unrecognized. The server response was: Unauthorized relay msg rejected ]



Any help I can get is appreciated.

Thank you and God Bless,

Mark A. Sma

Mar 21 '06 #1
Share this Question
Share on Google+
5 Replies


P: n/a
Have you already checked on www.systemwebmail.com ?

Sonu Kapoor [MVP]
---
Posted via www.DotNetSlackers.com
Mar 21 '06 #2

P: n/a
You probably need to supply a username and password to relay messages through that SMTP server.
"Mark A. Sam" <ms**@Plan-It-Earth.Net> wrote in message news:%2****************@tk2msftngp13.phx.gbl...
Hello,

I am sending two emails from the same procedure, one to myself (while testing) and another (a comfirmation) to the user on the website.

I was having difficulty finding a relay server to SMTP though, but was able to do this though one of my personal account, Cabbage.Org. It doesn't make any sense to me why this works and no other account, including localhost and the remote server which hosts the website.

Here is a code snippet showing the sending of both emails:

**************************
Dim MailObj As New System.Net.Mail.SmtpClient

MailObj.Host = "smtp.youthkaraoke.org"

MailObj.Send("ma**@dragonimports.com", "ms**@cabbage.org", strSubject, strBody) 'Change ms**@Truckloads.Net to working email

'Send confirmation to sender

strBody = "Thank you for submitting your request to Dragon Importing" + vbNewLine + _

"You will be contacted soon by one of our reprresentives!" + vbNewLine + vbNewLine + _

"The Dragon Importing Staff"

MailObj.Send("ma**@dragonimports.com", txtEmail.Text, "Confirmation", strBody)

*********************************

In the first send, ms**@cabbage.org is the recipient and the letter goes through without a problem. In the second, if the value of txtEmail.Text is ms**@cabbage.org, then no problem either, but if any other email address is used then I get this error:

Server Error in '/' Application.
------------------------------------------------------------------------------

Syntax error, command unrecognized. The server response was: Unauthorized relay msg rejected
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.Net.Mail.SmtpException: Syntax error, command unrecognized. The server response was: Unauthorized relay msg rejected

Source Error:

Line 79: "You will be contacted soon by one of our reprresentives!" + vbNewLine + vbNewLine + _
Line 80: "The Dragon Importing Staff"
Line 81: MailObj.Send("ma**@dragonimports.com", txtEmail.Text, "Confirmation", strBody)
Line 82:
Line 83:

Source File: C:\Domains\dragonimporting.com\wwwroot\Contact.asp x.vb Line: 81

Stack Trace:

[SmtpException: Syntax error, command unrecognized. The server response was: Unauthorized relay msg rejected ]



Any help I can get is appreciated.

Thank you and God Bless,

Mark A. Sma

Mar 21 '06 #3

P: n/a
Thanks Brendan. Do you know how do to that? I can't seem to find an example.

Mar 21 '06 #4

P: n/a
I pulled this from the MSDN Library:

public static void CreateTestMessage1(string server, int port)
{
string to = "ja**@contoso.com";
string from = "be*@contoso.com";
string subject = "Using the new SMTP client.";
string body = @"Using this new feature, you can send an e-mail message from an application very easily.";
MailMessage message = new MailMessage(from, to, subject, body);
SmtpClient client = new SmtpClient(server, port);
// Credentials are necessary if the server requires the client
// to authenticate before it will send e-mail on the client's behalf.
client.Credentials = CredentialCache.DefaultNetworkCredentials;

client.Send(message);
}

Instead of using DefaultNetworkCredentials, specify the appropriate username/password.
"Mark A. Sam" <ms**@Plan-It-Earth.Net> wrote in message news:ug**************@TK2MSFTNGP12.phx.gbl...
Thanks Brendan. Do you know how do to that? I can't seem to find an example.

Mar 22 '06 #5

P: n/a
Thanks Brendan. I changed to a different hosting company, which solved the problem. It accepted LocalHost.

"Brendan Green" <bg****@simtap.com.au> wrote in message news:uR**************@TK2MSFTNGP11.phx.gbl...
I pulled this from the MSDN Library:

public static void CreateTestMessage1(string server, int port)
{
string to = "ja**@contoso.com";
string from = "be*@contoso.com";
string subject = "Using the new SMTP client.";
string body = @"Using this new feature, you can send an e-mail message from an application very easily.";
MailMessage message = new MailMessage(from, to, subject, body);
SmtpClient client = new SmtpClient(server, port);
// Credentials are necessary if the server requires the client
// to authenticate before it will send e-mail on the client's behalf.
client.Credentials = CredentialCache.DefaultNetworkCredentials;

client.Send(message);
}

Instead of using DefaultNetworkCredentials, specify the appropriate username/password.
"Mark A. Sam" <ms**@Plan-It-Earth.Net> wrote in message news:ug**************@TK2MSFTNGP12.phx.gbl...
Thanks Brendan. Do you know how do to that? I can't seem to find an example.

Mar 22 '06 #6

This discussion thread is closed

Replies have been disabled for this discussion.