473,942 Members | 11,174 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 8865
Plater
7,872 Recognized Expert Expert
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.
Aug 12 '08 #11
cnixuser
80 New Member
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.
Have you had success sending to e-mail accounts hosted on goDaddy servers?
Aug 12 '08 #12
Plater
7,872 Recognized Expert Expert
Have you had success sending to e-mail accounts hosted on goDaddy servers?
I have not had any failures that I have seen.
Aug 12 '08 #13
cnixuser
80 New Member
I have not had any failures that I have seen.
I just can't figure out what it could be. I am able to send to gmail just fine without using credentials.
Aug 12 '08 #14
Plater
7,872 Recognized Expert Expert
I just can't figure out what it could be. I am able to send to gmail just fine without using credentials.
And I we all keep telling you that you need to use credentials.
There really shouldn't be anything difficult to grasp on this concept.
Have you even tried to use valid credentials?
Aug 12 '08 #15
cnixuser
80 New Member
And I we all keep telling you that you need to use credentials.
There really shouldn't be anything difficult to grasp on this concept.
Have you even tried to use valid credentials?
I tried using credentials from my gmail account yes "username" and "password", and when that didn't work, I tried "username@gmail .com", and "password".
Aug 12 '08 #16
Plater
7,872 Recognized Expert Expert
Ok now I don't know what you were doing.
You would not be able to send ANY email through gmail's mail servers without authenticating and using SSL, so you are probably using your company's mail server to send the mail. You must provide a valid login for THAT server in order to send emails successfully.
Aug 12 '08 #17
cnixuser
80 New Member
Ok now I don't know what you were doing.
You would not be able to send ANY email through gmail's mail servers without authenticating and using SSL, so you are probably using your company's mail server to send the mail. You must provide a valid login for THAT server in order to send emails successfully.
Well, I'm actually sending from the pc that I am running the application from. I set the SmtpClient as the local host (127.0.0.1). The pc is on a network independent from the one at work (a Verizon cellular modem). I do honestly have a misunderstandin g of how to use credentials. With my new description, do you believe still that I need the credentials for the server at my company which I would be sending to and not from?
Aug 12 '08 #18
cnixuser
80 New Member
Well, I'm actually sending from the pc that I am running the application from. I set the SmtpClient as the local host (127.0.0.1). The pc is on a network independent from the one at work (a Verizon cellular modem). I do honestly have a misunderstandin g of how to use credentials. With my new description, do you believe still that I need the credentials for the server at my company which I would be sending to and not from?
It occurs to me that if I had my SmtpClient as the localhost, I would have to alter some settings for my IIS virtual SMTP server, so that it was configured for authentication rather than anonymous access, and then in my code, add the credentials to my localhost's IIS virtual SMTP server. Plater, is this what you were trying to tell me to have authenticated? If so, I apologize for being too dense :)
Aug 12 '08 #19
Plater
7,872 Recognized Expert Expert
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
Aug 12 '08 #20

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
2066
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
3015
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
11120
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9862
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...
1
8219
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
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
6087
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
6304
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4909
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
3511
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.