If we have a program that is used to send a mail to store information on a popular mailbox such as gmail, hotmail etc. is it possible without hardcoding the password to send a mail to itself as a logg(a text file basically)??
Since i don't have my own website or host or anything similar, i thought that using a free mailbox to save some sensor logg history to a mail adress would be easy enough.
so the main principle would be basically to send to myself a mail containing the logg and that works great. But is it possible to avoid hardcoding the password into the client? So if i want to send the log to the mail, could we possibly send it to my mail with an unknown source(it's fully okay if it would go to the trash). As it looks now, i have to enter the hardcoded credentials into the program and then send to myself, otherwise it wont get it :(
Yes. You can create your own stmp server and connect it to your own e-mail. If you want to stay anonymous per se, you can use a temp mail.
C# xample can be found here: https://www.c-sharpcorner.com/article/sending-email-with-C-Sharp-using-smtp-servers/
You can, however, use almost any programming language to make an stmp server.
Related
I have several inquiry forms that I'd like to use a Gmail account to authenticate and send through. The forms send successfully, but the reply-to address is always the Gmail account, rather than the person's e-mail who filled out the form. This is a problem for the client in that they can't hit "Reply" without changing the reply-to address.
I've poked around the Gmail account and don't see anything that appears switch anything on and off to fix this. Any ideas?
My guess is that this is a restriction when using gmail as your SMTP server. You could use a different SMTP server to send the emails like MailDrill or MailGun.
OR
...and I'm not sure this will work. You can configure your gmail account to allow you to send emails with a different reply address/alias, but each address requires confirmation.
The steps to do this are located here
EDIT: I just re-read your message. Since you're using form data for the address I think your only option may be to use an alternate SMTP server.
Sorry I don't have a better answer.
I am trying to send emails using Yahoo or Gmail. Prior to that i want to check if the username and password combination of the email address i am using to send mails is ok and then send the email.
How can i achieve such a thing in Asp.net/C#?
Is there a way to find about the status of the sent email ? (delivered or failed?)
SmtpClient does not offer functions for testing credentials, e.g. just logging in without sending. So the .Net onboard way would be, as previously suggested, to Try/Catch your sending attempt.
If you insist on checking the credentials first, you'd have to implement the SMTP protocol, or parts of it, on your own, using .Net.Sockets.TcpClient. That way you could log on to the SMTP without sending anything.
It is possible to receive a so called NDR (Non-Delivery Report/Receipt), but since that is an email sent back to your designated bounce address, you would have to build an application to read those reports as a background process or similar. There is no guarantee that you will get an NDR.
I don't really see the point of checking username/password prior to sending. You would add error handling anyways, so it either fails or succeeds.
I have a windows machine that i want to write a C# or VB.net program to check an email account i own. This email account is a webmail (fatcow). I can also forward it to my gmail. What libraries are available that allow me to periodically check it (every 1 minute?) and parse the data in the body/subject and then send a response email.
Ideally, this program can queue up emails that are new and check up the quue
Take a look at the Gmail API's for hooking up to a gmail account and doing various things.
https://developers.google.com/google-apps/gmail/
Also you can take a look at some of the various open source email clients.
http://www.cyberciti.biz/tips/download-email-client-for-linux-mac-osx-windows.html
Those should give you a fairly good place to start. Also I believe I have seen simplistic email client tutorials around on the internet such as:
http://www.codeproject.com/Articles/34495/Building-your-own-Mail-Client-using-C
I'm a big fan of the email feature available in Backpack, where it creates a unique email address per backpack page, and any emails sent to that address will be posted to the page.
My question is about how best to go about creating new email addresses automatically, and listening for new emails sent to those addresses. I'd like to do this from a C# service (I'm not using ASP.Net)
Has anyone tried to achieve this or
something similar before?
Are there libraries (preferably
FLOSS) already available which do
this or would assist me?
Is it possible to do this using a cloud-based
email service (and if so, what service?) and a
library for communicating with that
service (OpenPop.Net or similar)?
If your email provider supports setting up wildcard email on your domain, then you can do this with a single email account.
For example, Google Apps for Domains allows setting *#example.com to be delivered to myaccount#example.com. When someone emails sales#example.com or contact#example.com it will all be delivered to myaccount#example.com.
Then it's a process of getting all the emails. You then look at the to header in the email, match that with the name stored in your application for that user, and then process however you wish.
Be aware that you will get spam and other incorrectly addressed emails when you use this method. You will have to deal with these yourself (eg by discarding incorrectly mail that isn't addressed to a valid account).
I haven't played around much with incoming mails, but from the top level here is what you should do.
Create email addresses for the users based on any logic and save it in the DB.
Setup a mail server with your domain name and set one email account as a "catch-all" mail account. Any mail sent to your domain would then be caught under that mail account, in case the email address is not found.
Create a windows service, that would read mails from that "Catch-All" account. There are several libraries available to read mails using POP3 or IMAP.
Read the incoming mails to check the email address it was sent to, compare it with the values stored in the DB and process accordingly.
Check this question. it might help you with reading incoming mails.
The objective isn't to create email addresses, that doesn't really happen. What you do is accept email addresses at your system, what you accept is up to you. You could set up a mail server to receive any email sent to your domain, you could then parse the email To field and extract the 'name' portion. If it matches something you are listening for then you action it accordingly.
I don't think you'll find a library for this specific activity as it's rather insular. There are plenty of ways of receiving emails directly or indirectly and processing them in C# but I won't cover that as mail handling in .Net is well documented.
I would like my program to email me a bug-report when it fails. Is there any way of doing this... safely? I have found I can use System.Net.Mail MailMessage and SmtpClient and such, but of course, I will have to provide a username and a password to it (unless someone knows of one that doesn't need it?). And putting that in code I find a bit... I don't know. Technically it would mean that anyone could look at the source code or the compiled IL code (or what it was called) and find that username and password and use it for spamming or other not so good activites. Which is not very good!
Any ideas? Is there a better and/or different approach to this problem? Doesn't really have to be through email. But what I want is a way for the program to notify when something happens that I should fix. And to make that notification as little troublesome as possible to the user. Maybe even invisible (although a YesNo messagebox might be polite).
Anyone?
Instead of sending mail you could set up a web service that would receive the reports. The web service could run over https if you want to protect the data.
I did this for a customer once and it worked well.
The only problem is if the program is running somewhere without internet access.
Edit:
Don't tell this to anyone, but we even took a screenshot of the program when it crashed and posted it together with all information about the error that we could gather. It was incredibly useful!
You don't need to provide your password to email to yourself, as you don't need other people's password to send email to them.
You only need a password if you relay an email over a third party's SMTP server.
If your SMTP client connects right to example.com on port 25 and sends an email to test#example.com, no password is needed.
example.com above means an MX record, not an A record. This is a special type of record that holds the name of the server where all emails for example.com should go. There is no easy way to look it up from .NET, but if you are not going to change your SMTP server's address, you may hardcode it into SmtpClient.Host property.
To find out your mail server's address, type nslookup -q=MX example.com at your command prompt.
SMTP is not the best way to report errors, though. Home providers often block traffic on port 25 to all servers but their, to prevent spamming etc.
You better make a web server, create an instance of System.Net.WebClient in your program and send bug reports over HTTP. It's more reliable and you can easily use your client's proxy settings.
You can put the username & password in a web.config/app.config file. You can also encrypt the contents of your .config file (see here).
I do the same sort of thing and when our mail server moves to require authenticated SMTP, we plan to add exceptions for mail from certain addresses so that our automated processes don't need to provide credentials. If you're stuck with authenticated SMTP you'll need to work with your mail service provider to set up the same sort of exception or supply your credentials.