473,387 Members | 1,650 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,387 software developers and data experts.

Using the new System.Net.Mail Namespace

I am trying to figure out how to send SMTP with the new .NET Mail
Namespace. I can send email to an address in my own domain, but when I
try to send email to someone in a different domain I get the relay
access denied error indicating some kind of authentication problem. Out
SMTP server appears to require authentication to send email to
addresses outside of our domain. My Outlook setup indiates that my
authentication is simply my email address and password. But I cannot
figure out how to pass a mailbox/password pair as authentication
credentials. My address is being specified as the From address in the
MailMessage object. And I have tried using default credentials with no
luck. I have also done extensive research on the web and msdn, but
cannot find anything that helps me get over this hurdle. What is the
trick?

In case you are interested, here is the code I am using:

Dim FromAddress As New MailAddress("my@email.address", "My Personal
Name")
Dim ToAddress As New MailAddress("ad*****@tosend.to", "To Familiar
Name")
Dim msg As New MailMessage(FromAddress, ToAddress)
Dim smtpSender As New SmtpClient("my smtphost.com")

msg.Subject = "This is a test message sent from a VB.NET application"
msg.Body = "Let me know if you got this"
smtpSender.UseDefaultCredentials = True
smtpSender.Port = 25
smtpSender.Send(msg)

Dec 8 '05 #1
1 976
Zacks,

The most important thing using this is that you use a good SMTP mailserver,
that can be any mailserver that allows to send mails from outside its own
domain, I get the idea, that this is filtered in the mailserver that you are
using. Although it should than as well not send mails inside its domain.

Cor
Dec 9 '05 #2

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

Similar topics

4
by: Bart de Vries | last post by:
Hello, I new on developing with ASP.NET and i wrote some lines of code. This works fine when all the code is in one page, but when i split it up into and ASPX file and make an DLL using a...
5
by: martin | last post by:
Hi, I have created a class that is totally seperate from my web application. However this class is used extensivly by the web application for stuff like data access. I wish to add a function to...
4
by: Jason Zhang | last post by:
Hi all, I have installed VS.net 2003 fully. When I create a C# project and write a line:using System.Web.Mail; the IDE complain that the namespace Mail does'nt exist in System.Web. Why it...
4
by: JPS | last post by:
When I add this to my references at the top of my form I get the error message "The type of namespace "mail" does not exist in the class or namespace "System.Web "
2
by: Ryan | last post by:
Hi, I receive an access denied error (see below) when attempting to send an email with BodyFormat=MailFormat.Html from an asp.net page. Exactly the same code works fine in a console...
1
by: Nick | last post by:
I am working on a website for a client and one of their requirements was to have a mailing list. I decided to XSLT to transform "templates" to HTML so that editing was very easy and less time...
5
by: rohan_from_mars | last post by:
I want a Windows C# application to allow users to send email. It is a windows application and not ASP.NET web application. So how do i do it? I know that ASP.NET allows to use SMTPMail class of...
1
by: Prasanta | last post by:
Hello, Please cnay one can tell me how to read mail as formatted.... i have made some code using that able to read but not able to serialize..... so am i need to parse the HTML, or is there any...
1
by: Prasanta | last post by:
Hello, How to read a mail from the mail server as formatted. I am able to read the mail as row HTML, is there any class, or something method using that i can easily get the all info of that...
11
by: Ed Bitzer | last post by:
I have been able using the namespace System.Web.Mail and its method Smtp.mail.send to mail simple text messages to a small group within our 55 and older community. I need help expanding the...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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...
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
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
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

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.