473,943 Members | 9,661 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

C# E-mail Client Mails Not Received

80 New Member
Hi, I am trying to write an application that will e-mail sales data reports once per day. I have largely succeeded in creating the application and I am able to e-mail my reports to some e-mail addresses such as gmail ones ;however, when attempting to send e-mails to addresses on my companies internal server the e-mails never arrive. I was wondering if anyone knew what could allow gmail addresses to receive e-mails from my application, but not allow other servers to receive mail from my application, below is the portion of code doing the e-mailing:

Expand|Select|Wrap|Line Numbers
  1.         public string SendEmail()
  2.         {
  3.             try
  4.             {
  5.                 using (System.Net.Mail.MailMessage message = new System.Net.Mail.MailMessage(EmailFrom, EmailTo))
  6.                 {
  7.                     message.Subject = ConfigurationManager.AppSettings["emailSubject"].ToString();
  8.                     message.Body = ConfigurationManager.AppSettings["emailMainBody"].ToString() + "\n\nSent On:\n" + DateTime.Now.ToString() + "\n" + SerialPortCommands.RemoveControlCharacterPairs(SerialPortCommands.Asciireport);
  9.                     //System.Net.Mail.SmtpClient Client = new System.Net.Mail.SmtpClient("localhost");
  10.                     System.Net.Mail.SmtpClient Client = new System.Net.Mail.SmtpClient("127.0.0.1");
  11.                     Client.DeliveryMethod = System.Net.Mail.SmtpDeliveryMethod.PickupDirectoryFromIis;
  12.                     Client.Send(message);
  13.                     Thread.Sleep(2000);
  14.                 }
  15.                 return null;
  16.             }
  17.             catch (Exception ex)
  18.             {
  19.                 Log.WriteToLog(ex);
  20.                 return "Error Code: email-1";
  21.                 Application.Restart();
  22.             }
  23.         }
And here are the relevant portions from my App.Config file:

Expand|Select|Wrap|Line Numbers
  1. <add key="ToAddress" value="AddressSendingTo@gmail.com"/>
  2.     <add key="FromAddress" value="test@foo.com"/>
  3.     <add key="emailSubject" value="==DEX Collector Message== Your Dex Report Has Been Sent"/>
  4.     <add key="emailMainBody" value="Vending Machine DEX Data"/>
  5.     <add key="MessageSendTime" value="1:17:00 PM"/>
any help would be greatly appreciated, as I am quite stumped :)
Aug 11 '08
27 8866
cnixuser
80 New Member
Hmmm no. It had actually not occured to me that you could be using localhost to send the emails. Will the final product be run in the same manor?

The crenedtials supplied are for the server you are sending mail from. so if you are sending mail from a localhost, I now understand your confusion about what credentials to send.
That being said there are a number of other things in the SMTP protocol that could cause your emails to be rejected. It's possible that godaddy implents the part of the protocol that says there needs to be a valid MX record for the address that is SENDING the messages.
i.e. it needs to be able to go -> somename@somedo main.com....che cking the lookup for somedomain.com
They may also go the next step which would be reverse validation and attempt to verify that someuser is a valid username in somedomain.com

and it could also be none of those and something else entirely.
Your best bet might be to get in touch with whoever handles your email and see if they can find anything in the logs about why your messages are rejected
client.UseDefau ltCredentials = true;
would send my local host's Credentials correct?
Aug 12 '08 #21
Plater
7,872 Recognized Expert Expert
client.UseDefau ltCredentials = true;
would send my local host's Credentials correct?
Mmm I think it actually looks in either machine.config or web.config (depending on application type) for them. Unsure what it will send if cannot find them.
Aug 12 '08 #22
cnixuser
80 New Member
Mmm I think it actually looks in either machine.config or web.config (depending on application type) for them. Unsure what it will send if cannot find them.
I have another question related to this ;however, at this point should I just go ahead and start a new thread?
Aug 12 '08 #23
Curtis Rutland
3,256 Recognized Expert Specialist
If it isn't directly related, yes.

Go ahead and post it. We can merge/split it if we need to.
Aug 12 '08 #24
joedeene
583 Contributor
Well technically no, because I built my own SMTPClient as I disliked the built in one.
But yes, I *DO* send the authentication information to the mail server, my mail server won't send emails out unless you are a valid user.

hey plater, you said you built your own smtpclient class, that has to be awesome, how would you come across doing that? did you implement any of it with the webclient class? just curious
Aug 13 '08 #25
Plater
7,872 Recognized Expert Expert
I did it with Sockets and the RFCs for the SMTP specs
Aug 13 '08 #26
joedeene
583 Contributor
I did it with Sockets and the RFCs for the SMTP specs
what are 'RFCs'? i typed it in google with .net nothing relevant came up
Aug 13 '08 #27
Plater
7,872 Recognized Expert Expert
RFCs are Request For Comments. They are used to define internet standards. They are not related to .NET
Aug 13 '08 #28

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

Similar topics

8
6231
by: Shagshag | last post by:
hello, does anyone know of a full python + wxWindows email client ? google didn't help me... thanks,
88
12691
by: Mike | last post by:
Is there a way to determine what a user's default email client is? I read a post from 3 years ago that said no. I guess I'm hoping something has come along since then.
3
2067
by: | last post by:
Hi grp, I new to this grp and python too. i have started writing few python scripts myself. now i am planning to write a bear minimum email client in pyhton. i found the smtp module of python could serve my pupose. I can send message using mails using the smtp lib. Now i'm looking for some modules which can help me in fetching the mails from the mailserver and managing folders.
7
5424
by: Daven Thrice | last post by:
I know how to send email out of Access, and that's no problem. What I need to figure out is how to receive email into access. Say that I give access an email address, such as access@daven.com. I want all email that comes to that address to be received directly by the database so that I can parse out the files. I'm thinking that, worst case, I can write my own email client using the winsock control. But is that my only alternative?
2
2740
by: Marcus | last post by:
Is there a way to have Access 2002 open a particular email client, when using DoCmd.SendObject? So far, Access simply opens the default email client that is set under Control Panel/Internet Options. I would like to open the email client for Netscape Communicator 4.78, or Netscape 7.1. I'm not very sure, but I think calling these email clients might have something to do with dll files. I am using the following code:
1
8169
by: Craig | last post by:
Hiya Everyone, I've just started the development of an email client using the .NET classes and C# ( I figured its a good way to get my hands dirty with ..NET). Anyhow, here's the situation... I created a simple 'Windows Forms' app (using Borland's wonderful free C# Builder IDE) that allows me to create a mail message and send it via my SMTP Server.
1
3016
by: Larry Rebich | last post by:
I'm trying to launch the user's email client using 'MailTo:'. So I put a button on an aspx page and wrote some .vb code to use 'Mailto:' and it works on my development machine when I press the button. But when I publish the site to our server, pressing the button does not launch the email client on the user's computer. Is there a way - some code - that I can launch the user's email client using MailTo?
5
2943
by: Franz Steinhaeusler | last post by:
Hi, although I have googled, I didn't find a Python email client program fitting to my needs. What I want is a program (it doesn't have to be so sophisticated as thunderbird) written totally in python and using a gui toolkit like pyqt, pygtk, wxpyhton or tkinter. Who knows such a program? ;) best regards,
0
10135
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9970
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
11532
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...
0
10662
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
9864
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, and deployment—without 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...
0
7390
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
6308
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4910
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
4510
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.