473,396 Members | 1,797 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Problem sending email from Webform

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
5 4850
Have you already checked on www.systemwebmail.com ?

Sonu Kapoor [MVP]
---
Posted via www.DotNetSlackers.com
Mar 21 '06 #2
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
Thanks Brendan. Do you know how do to that? I can't seem to find an example.

Mar 21 '06 #4
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
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Marre | last post by:
Hi all! I would like to get data from a webform, push a button and fire up Word. Here i would like to retrieve data from my webform. Is there a way to do this without using chrystal reports? ...
3
by: VB Programmer | last post by:
My company has it's own webserver, which is going to host our ASP.NET web application. We want the website to be able to send out emails. 1. What do I need on the server so that it has the...
1
by: Leszek | last post by:
Hello, A few weeks ago I sent a post about sending encrypted emails. I found out how to encrypt such emails using .NET, but now there is another step: How to receive them? Let's say I have...
2
by: Helge Kalnes | last post by:
We are running an ASP.NET application on a cluster of 3 web-servers, using the Network Load Balancing feature of Application Center. We have synchronized the machineKey in machine.config on the 3...
2
by: Dee | last post by:
Hi I have added EnableViewStateMac="false" to the sending WebForm's @Page Directive and my sample code has the following line: Dim coll As...
2
by: Steven Bazeley | last post by:
I need to send a large list of emails from a webform by clicking a single button. Microsoft's documentation for coding this seems straight forward and I'm about to begin experimenting with their...
3
by: bazzer | last post by:
hello all, as part of an application im developing with asp.net webforms, i need a user whos using the application to be able to receive an email confirmation of a booking they made using the...
4
by: Goran Djuranovic | last post by:
Hi all, I am experiencing a strange thing happening with a "designer.vb" page. Controls I manually declare in this page are automatically deleted after I drop another control on a ".aspx" page. -...
0
Dormilich
by: Dormilich | last post by:
this is a follow-up thread to this one. http://bytes.com/topic/html-css/answers/863662-form-not-submitted-sometimes I figured out that the mail sending class triggers the described error....
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.