473,396 Members | 2,111 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.

Email using asp.net and System.Web.Mail


I wrote a little code snipet in Asp.Net to send a default
message to my outlook email address. That works fine,
since the SMTP virtual server default domain is same
domain as my outlook mail server:

myMessage.To = "js****@universalmoney.com"
myMail.SmtpServer = "mail.universalmoney.com"

But when I try to sent to bl******@page.nextel.com, I get
the following error:

The server rejected one or more recipient addresses. The
server response was: 550 not local host page.nextel.com,
not a gateway.

Now, I have seen this problem come up in Outlook, where
you must click the "My server requires authentication"
box, to get around this error. But I can't find a similar
box in the SMTP virtual Server properties. Do you know how
I can get around this problem?

Thanks for your help,
JSzucs
Jul 19 '05 #1
1 7055
Hello JSzucs,

Thanks for your post. I'd like to share the following information with you:

Would you please tell me what mail.universalmoney.com is, a server running
SMTP Sevices or an Exchange Server?

1. If it's SMTP sever, we should onfigure the it to allow relay and set
Outbound Security by the following steps:

a. Go to "Start" -> "Control Panel" -> "Administrative Tools" -> "Internet
Information Services"
b. Right click "Default SMTP Virtual Server", select "Properties".
c. In "Access" panel, click "Relay", choose "All except the list below"
radio button, click OK.
d. Open "Delivery" panel, click "Advanced", in the "Smart host" setting,
input the smarthost or exchange or remote smtpserver name or ip address.
e. Click "OK" button, click "Outbound Security" in "Delivery" panel, choose
"Basic Authentication", input the user name and password for your email
account.

2. If it's an Exchange Server, I recommend using CDOSYS instead of SmtpMail
(System.Web.Mail) as CDOSYS gives
more configuration flexibilty. Here is the code for sending email using
CDOSYS in VB .NET using Port:

Sample:
1) Start Microsoft Visual Studio .NET. On the File menu, click New and then
click Project. Select Console Application from the Visual Basic Projects
types. Module1.vb is created by default.

2) Add a reference to the Microsoft CDO For Windows 2000 Library. To do
this, follow these steps:
a. On the Project menu, click Add Reference.
b. On the COM tab, locate Microsoft CDO For Windows 2000 Library and click
Select.
c. Click OK in the Add References dialog box to accept your selections. If
you receive a prompt to generate wrappers for the libraries you selected,
click Yes.

3) Follow the same steps to add a reference to the Microsoft ActiveX Data
Objects 2.5 Library

4) In the code window, replace the whole code with:
Imports System.Reflection
Module Module1
Sub Main()
Dim oMsg As CDO.Message = New CDO.Message()
Dim iConfg As CDO.Configuration
Dim oFields As ADODB.Fields
Dim oField As ADODB.Field

iConfg = oMsg.Configuration
oFields = iConfg.Fields
oField =
oFields("<http://schemas.microsoft.com/cdo/configuration/sendusing>")
oField.Value = 2 'CDO.CdoSendUsing.cdoSendUsingPort
' TODO: Replace with the Port you want to use (Needs to be the same
' port that the SMTP server is using)
oField =
oFields("<http://schemas.microsoft.com/cdo/configuration/smtpserverport>")
oField.Value = 25

' TODO: Replace with your SMTP server
oField =
oFields("<http://schemas.microsoft.com/cdo/configuration/smtpserver>")
oField.Value = "<SMTP Server>"
oFields.Update()
oMsg.Configuration = iConfg
oMsg.TextBody = "Test message body."
oMsg.Subject = "Test SMTP Message Send using port"
oMsg.From = "fr**@microsoft.com <mailto:fr**@microsoft.com>"
oMsg.To = "to@microsoft.com <mailto:to@microsoft.com>"
oMsg.Send()
oMsg = Nothing
iConfg = Nothing
oFields = Nothing
oField = Nothing
End Sub
End Module

5) Modify code where you see TODO.

Please feel free to let me know if you have any problems or concern.

Have a nice day!

Regards,

HuangTM
Microsoft Online Partner Support
MCSE/MCSD

Get Secure! ¨C www.microsoft.com/security
This posting is provided ¡°as is¡± with no warranties and confers no rights.

Jul 21 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: James Hong | last post by:
Help please, I try to sending an email from my html page using the java applet. but it give error on most of the PC only very few work, what is the error i make the java applet show as below ...
11
by: tshad | last post by:
I have a W2003 server running my website and I am trying to set up my pages to send email using System.Web.Mail. I have pages running on this machine using CDONTS that work fine. I am using...
6
by: Eduardo Rosa | last post by:
Somebody knows how I queue email using .Net? thanks a lot
6
by: \jason via DotNetMonster.com\ | last post by:
currently i am doing a personal website and keep on changing the aspect... finally the finall decision is to have a login page (requirement in asp.net, vb.net) and the login with security part of...
8
by: shapper | last post by:
Hello, I am trying to send an email using Asp.Net 2.0. I am getting the following error: System.Net.Mail.SmtpFailedRecipientException: Mailbox unavailable. The server response was: No such...
4
Frinavale
by: Frinavale | last post by:
Introduction Many .NET applications will require an email be sent out for various reasons. This article will give a quick examples on how to send an email using VB.NET. The examples given can...
2
by: Allie | last post by:
Hi, all. I'm new to C# programming. I'm even newer to programming email capabilities into my code. What I need to do is create three (3) functions: * sendEmail, using a Mail object (which needs...
2
by: Eugene Vital | last post by:
Hi all I am having trouble with sending email via a C#2.0 application, I use the same settings as I use in Outlook but I cannot get email to send. I am trying to use SSL on port 465 and get the...
2
by: anu b | last post by:
Now i am sending email to my friend using session variable... but my code is as below private bool SendEmail(string email) { try
3
by: anu b | last post by:
Hii I am using System.net.mail for sending email... i need to send a webpage with its html content as my email body .....for that i used mail.Isbodyhtml as true...but it is not working for me...
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
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
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
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

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.