473,830 Members | 2,014 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 #1
27 8841
Curtis Rutland
3,256 Recognized Expert Specialist
Are you sure that your emails aren't going to your junk mail boxes? I almost drove myself crazy that way once
Aug 12 '08 #2
cnixuser
80 New Member
Are you sure that your emails aren't going to your junk mail boxes? I almost drove myself crazy that way once
When I check my company e-mail address, I find no e-mail in the junk mail box. When I send to my gmail account, the e-mail always goes through with no problem.
Aug 12 '08 #3
Plater
7,872 Recognized Expert Expert
I would check the logs on the company email server, they may be getting rejected before even making it to client's emails.
Are you sending the emails from a valid email account? Have you checked THAT accounts email box? There might be like "destinatio n unreachable" or something emails in there that might better describe it.
Aug 12 '08 #4
cnixuser
80 New Member
I would check the logs on the company email server, they may be getting rejected before even making it to client's emails.
Are you sending the emails from a valid email account? Have you checked THAT accounts email box? There might be like "destinatio n unreachable" or something emails in there that might better describe it.
Well, I'm not actually sending from an e-mail account that I have set up. For example I can use a purely non-existent dummy address "test@foo.c om", to get the reports sent to gmail.
Aug 12 '08 #5
Plater
7,872 Recognized Expert Expert
Well, I'm not actually sending from an e-mail account that I have set up. For example I can use a purely non-existent dummy address "test@foo.c om", to get the reports sent to gmail.
Hmm, try sending from a valid email account and see if your company's server lets the emails go through?
Aug 12 '08 #6
cnixuser
80 New Member
Hmm, try sending from a valid email account and see if your company's server lets the emails go through?
I have tried that from my development pc here at work, which does have an e-mail account set up with the company and it works ;however, this won't be doable for the pc's that are going to be hosting the application out in the field. I did consult IT, and found out that our e-mail accounts are actually handled by godaddy.com, would this have any impact on changes that I might have to make to my code?
Aug 12 '08 #7
Curtis Rutland
3,256 Recognized Expert Specialist
I think that it just has to come from a real valid email address. It can be the same one, but they have to be real.

That's one of those things that are determined by the server.
Aug 12 '08 #8
Plater
7,872 Recognized Expert Expert
Yes, just make a dummy account on the email server for it. We use one that's ReportServer@ou rdomain.com that sounds out reports
Aug 12 '08 #9
cnixuser
80 New Member
Yes, just make a dummy account on the email server for it. We use one that's ReportServer@ou rdomain.com that sounds out reports
Do you used SmtpClient.Cred entials = new NetworkCredenti al("username"," password"); anywhere in your code, with the object reference to the SmtpClient used instead of directly here of course :)
Aug 12 '08 #10

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

Similar topics

8
6228
by: Shagshag | last post by:
hello, does anyone know of a full python + wxWindows email client ? google didn't help me... thanks,
88
12603
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
2056
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
5417
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
2720
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
8164
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
3008
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
2940
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
9793
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
9642
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,...
1
10526
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
10206
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...
1
7746
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
6951
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
5617
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...
1
4411
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
3
3076
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.