473,657 Members | 2,435 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

SmtpMail

Hi

just a really quick simple question. Can you configure SmtpMail class in C#
to use a different port? or does it have to be port 25?

Thanks
Jason
Nov 16 '05 #1
7 3807
Hello,

No, it is not possible. You can use the System.Web.Mail namespace instead.
Here's an example for you:

http://www.codeproject.com/dotnet/Sy..._SMTP_AUTH.asp

Good Luck!

--
Regards,
Kristofer Gafvert
http://www.ilopia.com
"Jason" <c_*******@migh ty.co.za> wrote in message
news:um******** ******@tk2msftn gp13.phx.gbl...
Hi

just a really quick simple question. Can you configure SmtpMail class in C# to use a different port? or does it have to be port 25?

Thanks
Jason

Nov 16 '05 #2
Not sure why you say 'No' while the answer is Yes. The SmtpMail class is
part of the System.Web.Mail namespace.
Am I missing something?

Willy.
"Kristofer Gafvert" <kg******@NEWSi lopia.com> wrote in message
news:O1******** ******@TK2MSFTN GP10.phx.gbl...
Hello,

No, it is not possible. You can use the System.Web.Mail namespace instead.
Here's an example for you:

http://www.codeproject.com/dotnet/Sy..._SMTP_AUTH.asp

Good Luck!

--
Regards,
Kristofer Gafvert
http://www.ilopia.com
"Jason" <c_*******@migh ty.co.za> wrote in message
news:um******** ******@tk2msftn gp13.phx.gbl...
Hi

just a really quick simple question. Can you configure SmtpMail class in

C#
to use a different port? or does it have to be port 25?

Thanks
Jason


Nov 16 '05 #3
Can you please tell me how to set the port with SmtpMail? As far as i know,
it is not possible.

I should of course have said that i was talking about the MailMessage class
in the System.Web.Mail namespace. Sorry for that. But i provided a link with
explained code.

--
Regards,
Kristofer Gafvert
http://www.ilopia.com
"Willy Denoyette [MVP]" <wi************ *@pandora.be> wrote in message
news:uA******** ******@TK2MSFTN GP12.phx.gbl...
Not sure why you say 'No' while the answer is Yes. The SmtpMail class is
part of the System.Web.Mail namespace.
Am I missing something?

Willy.
"Kristofer Gafvert" <kg******@NEWSi lopia.com> wrote in message
news:O1******** ******@TK2MSFTN GP10.phx.gbl...
Hello,

No, it is not possible. You can use the System.Web.Mail namespace instead. Here's an example for you:

http://www.codeproject.com/dotnet/Sy..._SMTP_AUTH.asp

Good Luck!

--
Regards,
Kristofer Gafvert
http://www.ilopia.com
"Jason" <c_*******@migh ty.co.za> wrote in message
news:um******** ******@tk2msftn gp13.phx.gbl...
Hi

just a really quick simple question. Can you configure SmtpMail class
in C#
to use a different port? or does it have to be port 25?

Thanks
Jason



Nov 16 '05 #4
"Jason" <c_*******@migh ty.co.za> wrote in message
news:um******** ******@tk2msftn gp13.phx.gbl...
just a really quick simple question. Can you configure SmtpMail class in C# to use a different port? or does it have to be port 25?


No - you'd need to use something like aspNetMail for that...
http://www.dotnet247.com/247referenc...26/131288.aspx
Nov 16 '05 #5


"Kristofer Gafvert" <kg******@NEWSi lopia.com> wrote in message
news:eH******** ******@TK2MSFTN GP12.phx.gbl...
Can you please tell me how to set the port with SmtpMail? As far as i
know,
it is not possible.

I should of course have said that i was talking about the MailMessage
class
in the System.Web.Mail namespace. Sorry for that. But i provided a link
with
explained code.

--

The question was about a class SmtpMail and you answer with "No, it is not
possible.You can use the System.Web.Mail namespace" but the SmtpMail class
is part of the same namespace, this is confusing and doesn't answer the
question, tough the sample does.

Feel free to disagree, but IMHO a better answer would have been;

You can use "System.Web.Mai l MailMessage" class "Fields" properties to
specify an alternate port and use an instance of this class in the
SmtpMail.Send(M ailMessage) overload.
Here's an example for you:
.....

Willy.
Nov 16 '05 #6
I am terrible sorry that i forgot a few words in my message. I am only a
human, and i do misstakes(!) But I gave a link that explained what to use,
and how to use it.

In my opinon, i answered the question correctly, because the question was:

"Can you configure SmtpMail class in C# to use a different port?"

I said: "No, it is not possible"

I then forgot to add the class name in my next sentence, so it became:

"You can use the System.Web.Mail namespace instead"

Instead of the correct:

"You can use the SmtpMail class of the System.Web.Mail namespace instead"
Again, i'm sorry if this offended you or anyone else. Atleast i gave a link
that explained everything, which i cannot see that you did (did you even
answer the question?). And the answer to the question is not "Yes", as you
said, because you cannot specify a port number when using the SmtpMail
class.

Sorry...

--
Regards,
Kristofer Gafvert
http://www.ilopia.com
"Willy Denoyette [MVP]" <wi************ *@pandora.be> wrote in message
news:ev******** *****@TK2MSFTNG P09.phx.gbl...


"Kristofer Gafvert" <kg******@NEWSi lopia.com> wrote in message
news:eH******** ******@TK2MSFTN GP12.phx.gbl...
Can you please tell me how to set the port with SmtpMail? As far as i
know,
it is not possible.

I should of course have said that i was talking about the MailMessage
class
in the System.Web.Mail namespace. Sorry for that. But i provided a link
with
explained code.

--

The question was about a class SmtpMail and you answer with "No, it is not
possible.You can use the System.Web.Mail namespace" but the SmtpMail

class is part of the same namespace, this is confusing and doesn't answer the
question, tough the sample does.

Feel free to disagree, but IMHO a better answer would have been;

You can use "System.Web.Mai l MailMessage" class "Fields" properties to
specify an alternate port and use an instance of this class in the
SmtpMail.Send(M ailMessage) overload.
Here's an example for you:
....

Willy.

Nov 16 '05 #7
See inline ***

Willy.

"Kristofer Gafvert" <kg******@NEWSi lopia.com> wrote in message
news:et******** *****@TK2MSFTNG P09.phx.gbl...
I am terrible sorry that i forgot a few words in my message. I am only a
human, and i do misstakes(!) But I gave a link that explained what to use,
and how to use it.
*** Please we are not talking about the link to the example. I'm human too,
and I can also make mistakes without being offended when someone points me
to my mistakes.
In my opinon, i answered the question correctly, *** Right, if you add a lot of missing words :-) "Can you configure SmtpMail class in C# to use a different port?"

I said: "No, it is not possible"

I then forgot to add the class name in my next sentence, so it became:

"You can use the System.Web.Mail namespace instead"

Instead of the correct:

"You can use the SmtpMail class of the System.Web.Mail namespace instead"
Again, i'm sorry if this offended you or anyone else. Atleast i gave a
link
that explained everything, which i cannot see that you did (did you even
answer the question?).
*** No offence taken, but I wasn't replying to OP, I was only pointing to
what, IMO, seems confusing in your reply (remember a few words missing), and
because the example explained it all.

And the answer to the question is not "Yes", as you
*** You have to call SmtpMail.Send with the MailMessage class instance as
argument to set the CDOSYS property that changes the port number, so you
need both SmtpMail and MailMessage, the MailMessage object alone won't be of
no use without SmptMail.Send.

said, because you cannot specify a port number when using the SmtpMail
class.
*** OP's question was if you could "configure SmtpMail to .... , and the
answer is NO "you can't configure the SmtpMail class", but you must use
SmtPMail to configure another port..... (see above).
Maybe we can agree on this and stop this silly discussion.

Sorry...

Nov 16 '05 #8

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

Similar topics

2
2540
by: Leszek | last post by:
Hello, I have created a simple code to send emails using the MailMessage class and the SmtpMail.Send() method: MailMessage mail = new MailMessage(); mail.From = echidna@somewhere.com; // hard-coded mail.To = platypus@somewhere.com; mail.Subject = "Test"; mail.Body = strMessage;
5
2141
by: ElanKathir | last post by:
Hi ! I wrote one code for Send the E-mail, But that code have some problem , So please help me Here i paste my code and Error: Error: Server Error in '/Elan_Sample' Application. --------------------------------------------------------------------------------
2
1797
by: Edward | last post by:
Hello, everybody, I tried to send Email out using ASP.NET, but failed, here is the code of sending: -------------------------------------------------------------------------------- Try Try 'SmtpMail.SmtpServer = "smtp.citiz.net"
1
2694
by: Jens Øster | last post by:
Hi I am writing a ASP.NET web application that must sent some e-mails. I get the exception “Could not access 'CDO.Message' object” when I call SmtpMail.Send. This only happens when I send e-mail addresses out side my company walls. When the e-mail is send on some one in my company it works perfect. I think it is a relay issue. Our system administrator will not allow relaying. In the ASP.Net web.config file I let the web application...
3
9251
by: Jens | last post by:
Hi I am writing a ASP.NET web application that must sent some e-mails. I get the exception “Could not access 'CDO.Message' object” when I call SmtpMail.Send. This only happens when I send e-mail addresses out side my company walls. When the e-mail is send on some one in my company it works perfect. I think it is a relay issue. Our system administrator will not allow relaying. In the ASP.Net web.config file I let the web application...
4
7541
by: Aren Cambre | last post by:
Why does SmtpMail.Send throw an exception if the MailMessage's BodyFormat = MailFormat.Html? I've searched all over the place and cannot find a solution anywhere. I am running this on Windows XP SP2, and IIS's SMTP and WWW servers are installed. Here is the error trace: System.Web.HttpException: Could not access 'CDO.Message' object. ---> System.Reflection.TargetInvocationException: Exception has been thrown by the target of an...
2
1831
by: kmbarz | last post by:
I'm trying to expand my horizons here by working through an ASP.Net book. When I do the example that uses: Line 55: Mail.From = "feedback@graymad.com" Line 56: SmtpMail.SmtpServer = "localhost" Line 57: SmtpMail.Send(Mail) I get: myemail@comcast.net
3
1560
by: aslantifosi | last post by:
hi all, My question is about that i use a smpt server which is running on a different machine from my webserver machine. And i can authenticate with a user and password. I use SmtpMail class. i set the smtpserver property. but how can i authenticate with my user and pass? for ex: my user :xxxx@xxx.com pass :12345
19
3361
by: zdrakec | last post by:
Hello all: Using an "Imports System.Web.Mail" clause at the head of my module, and after executing the following code: Dim msg As New MailMessage msg.From = sender msg.To = recipient msg.Attachments.Add(New MailAttachment(attachFile)) msg.Subject = subjectString
0
8826
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
8503
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8605
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7330
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 projectplanning, coding, testing, and deploymentwithout human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6166
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupr who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5632
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4155
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4306
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
1955
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.