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

smtp server issue

Hi Everybody,

i have a problem with smtp server. i developed an application on my local machine and it runs fine.it uses our smtp server to send emails. but when i uploaded the app on to the server it does not send any emails although it is using the same smtp server.

our smtp server settings are definitly not an issue. anonymous access is given there is no limit on number of messages everything is fine.i dont know how is it able to work on local mahcine and not on server(even though both are using same smtp server)

did anyone face this kind of problem. please let me know if you have any ideas

Ayush
Sep 19 '08 #1
8 1390
Plater
7,872 Expert 4TB
Have you put in code to see why it is failing?
Sep 19 '08 #2
Frinavale
9,735 Expert Mod 8TB
Make sure there are no Firewalls or Proxies that could be blocking emails.

Check your Windows event logs for any details about what might be failing...

In your code, put try catches in and check if emails were sent success fully...if not then record it into a log so that you can determine what the problem is.

-Frinny
Sep 19 '08 #3
Hi all,
thank you for replying.This code worked before. it sent emails but now it suddenly stopped working. there are no major changes we did to server settings. there are no firewalls and proxies. I cannot see anything in smtp log there are no details listed about the mail sent at that time. i tried sending emails from command prompt of that server and the emails went out.so i think this is not a server issue. but the code worked before i dont know whats wrong now. any ideas?

Code:(text)
Expand|Select|Wrap|Line Numbers
  1.  Try
  2.             oEmail.To = recipient
  3.             oEmail.Subject = subject
  4.             oEmail.Body = message
  5.             oEmail.BodyFormat = bodyFormat
  6.             oEmail.From = sender
  7.  
  8.             oEmail.Fields.Item("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
  9.             oEmail.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpserver") = hostSmtpServer
  10.             oEmail.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25
  11.             oEmail.Fields.Item("http://schemas.microsoft.com/cdo/configuration/sendusername") = "fgtt\ggggg"
  12.             oEmail.Fields.Item("http://schemas.microsoft.com/cdo/configuration/sendpassword") = "hghg"
  13.  
  14.             SmtpMail.SmtpServer = hostSmtpServer
  15.             SmtpMail.Send(oEmail)
  16.  
  17.         Catch
  18.         End Try
Sep 22 '08 #4
Frinavale
9,735 Expert Mod 8TB
Record any exceptions you've encountered in your Catch block....you could write it to a text file, record it to an event log....but right now you are catching the exception and not doing anything with it.

You could remove the Try Catch block for testing purposes...when an exception is thrown it should appear in your Windows Application Event Log in this case....
Sep 22 '08 #5
i tried catching an exception but there is no exception thrown nor i can see some error in event viewer.

what is strange is i can send the emails from a command prompt from the server that my application is, using smtp server that is sending emails. but when i do the same thing from website it does not happen. so theres definitly something wrong with the code.

Expand|Select|Wrap|Line Numbers
  1. Public Shared Sub SendEmail(ByVal recipient As String, _
  2.                                 ByVal sender As String, _
  3.                                 ByVal subject As String, _
  4.                                 ByVal message As String, _
  5.                                 ByVal hostSmtpServer As String, _
  6.                                 Optional ByVal bodyFormat As MailFormat = MailFormat.Html)
  7.  
  8.         Dim oEmail As New MailMessage
  9.  
  10.         Try
  11.             oEmail.To = recipient
  12.             oEmail.Subject = subject
  13.             oEmail.Body = message
  14.             oEmail.BodyFormat = bodyFormat
  15.             oEmail.From = sender
  16.  
  17.             oEmail.Fields.Item("http://schemas.microsoft.com/cdo/configuration/sendusing") = 1
  18.             oEmail.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpserver") = hostSmtpServer
  19.             oEmail.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25
  20.  
  21.             SmtpMail.SmtpServer = hostSmtpServer
  22.             SmtpMail.Send(oEmail)
  23.  
  24.         Catch Ex As Exception
  25.             Dim objStreamWriter As StreamWriter
  26.             objStreamWriter = File.AppendText("C:\sample.txt")
  27.             objStreamWriter.WriteLine(Ex)
  28.             objStreamWriter.Close()
  29.  
  30.         End Try
  31.  
  32.     End Sub
  33.  
(Hi Frinavale,
please let me know how to add code tags i have no idea how to do that.)


Ayush
Sep 23 '08 #6
Curtis Rutland
3,256 Expert 2GB
You can use the # button on the text editor to insert your opening and closing code tags.

It's like HTML with square brackets instead. [code] to open, and you close by putting a slash in between the bracket and the c: [/C
Sep 23 '08 #7
Frinavale
9,735 Expert Mod 8TB
What version of .NET are you using and what namesapce are you using to create your MailMessage?

The only thing that I'm unsure of in your code is the use of the Fields property. Looking up the MailMessage control (in the System.Net.Mail namespace) I don't see a Fields property at all...I've never used this property.

Anyways, give the following code a try and see if it works.
(Please note that right now I'm unable to fully test the code so it may not work 100%)

Expand|Select|Wrap|Line Numbers
  1.  Public Shared sub SendEmail(ByVal recipient As String, _
  2.    ByVal sender As String, _
  3.    ByVal subject As String, _
  4.    ByVal message As String, _
  5.    ByVal hostSmtpServer As String, _
  6.    Optional ByVal bodyFormat As MailFormat = MailFormat.Html)
  7.  
  8.  
  9.  
  10.   Try
  11.   'oEmail.To = recipient
  12.   'oEmail.Subject = subject
  13.   'oEmail.Body = message
  14.   'oEmail.BodyFormat = bodyFormat
  15.   'oEmail.From = sender
  16.  
  17.  'oEmail.Fields.Item("http://schemas.microsoft.com/cdo/configuration/sendusing") = 1
  18.  'oEmail.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpserver") = hostSmtpServer
  19.  'oEmail.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25
  20. oEmail= New Net.Mail.MailMessage(sender, recipient, subject, message)
  21.  
  22.  
  23. 'SmtpMail.SmtpServer = hostSmtpServer
  24. 'SmtpMail.Send(oEmail)
  25.  
  26. Dim mailClient As New Net.Mail.SmtpClient(hostSmtpServer, 25)
  27. mailClient.Send(oEmail)
  28.  
  29.  Catch Ex As Exception
  30.  Dim objStreamWriter As StreamWriter
  31.  objStreamWriter = File.AppendText("C:\sample.txt")
  32.  objStreamWriter.WriteLine(Ex)
  33.  objStreamWriter.Close()
  34.  
  35.  End Try
  36.  
  37.  End Sub
  38.  
  39.  
Also, does your mail server provider require credentials in order to send emails?

-Frinny
Sep 23 '08 #8
Hi,

I am using .NET 1.1 VS 2003. I am using "Imports System.Web.Mail" mail sever does not need credentials . I removed credentials and checked it it still doesn't send any emails.
Sep 23 '08 #9

Sign in to post your reply or Sign up for a free account.

Similar topics

4
by: Gerhard | last post by:
Hi, I some asp.net beta 2 code that works fine on an XP Pro machine, but on a Windows 2003 Server gets the following error: System.Net.Mail.SmtpFailedRecipientException {"Mailbox unavailable....
9
by: Bob Jones | last post by:
We have developed a commercial ASP.net application (personal nutrition management and tracking); we want to send smtp email from within it. For our development box, we use WinXP Pro, IIS 5.5,...
2
by: scorpion53061 | last post by:
I would like to know how you guys are handling this issue...... Some ISP's are now requiring authentication when using SMTP (such as orcsweb) while others are refusing to accept plain text...
2
by: 00_DotNetWarrior | last post by:
I followed this article to do authenticated SMTP, it works fine with port 25. (using .NET framework 1.1) http://support.microsoft.com/default.aspx?scid=kb;en-us;555287 However, if I change the...
2
by: desais | last post by:
I am using the cdo.dll to send out emails in C#. But instead of connecting to my local smtp to forward the email I am changing the smtp server to the recipients server for each email. This works...
34
by: antonyliu2002 | last post by:
I've set up the virtual smtp server on my IIS 5.1 like so: 1. Assign IP address to "All Unassigned", and listen to port 25. 2. Access Connection granted to "127.0.0.1". 3. Relay only allow...
1
by: Benny Ng | last post by:
Dear All, Now I just finished my winform application. And a part of that is to send email reminder to the users. It's working fine in the server that with SMTP service in Windows 2003. But now...
5
by: =?Utf-8?B?TWlrZQ==?= | last post by:
Hi, I'm using this code for sending emails and its working fine because I had configured SMTP in my machine in IIS. now I'm using machine as a server for this application. but when running the...
3
by: tamaker | last post by:
I have Road Runner cable internet access and Im working in a local development environment (writing .ASP) and have a site running on my network on a windows xp pro machine via IIS with CDONTS...
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...
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
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...
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.