I need to send an email in my C# project using my companies Exchange Server.
Because someone sent out thousands of Emails from my company using a self hosted server, any attempts to not use the company Exchange Server to send the email will be squished.
I imagine I am going to need to get an Active Directory user created to do this... but what code to use? How to do the sending?
You can send email through Exchange using SMTP with .Net's SmtpClient class.
You will need a login for the server.
You could use the System.Net.Mail classes to send the email via SMTP if that is enabled on your SMTP server. Alternatively you could use the webdav protocol to send the email via HttpRequests and HttpResponses. An example showing how to do this can be found here.
Related
i used Simple Mail Transfer Protocol gmail host to send emails from gmail it works fine.but when try to send email from yahoo or outlook it doesn't work. Is it Possible to send emails from all type of mails like yahoo,outlook etc in Simple Mail Transfer Protocol using common Simple Mail Transfer Protocol host in c# ?
Yes, C# has built in support for sending emails using any standard SMTP server
If your question is more about why gmail and outlook didn't work when you tried you'll need to include more detail such as error messages. As long as gmail/outlook do provide an accessible and protocol compliant SMTP service on your country/to your location, and you're using it in accordance with their instructions/you're properly authenticating with an account that has access, and they aren't classifying your mail as spam then the mail should be sent as with any other SMTP service
https://support.google.com/a/answer/176600?hl=en
https://support.office.com/en-us/article/pop-imap-and-smtp-settings-for-outlook-com-d088b986-291d-42b8-9564-9c414e2aa040
In asp.net mvc, how can I send email without external SMTP server? Does IIS can help me with this job?
Normally, I can use SmtpClient to send email, but I have to config an external server such as 'smtp.gmail.com' to help me send the mail, also I have to set the credentials for it which we may need to create a new account for our app in Gmail, that's what we want to avoid. What we want to achieve is just send an email to user, and with that email user can confirm their information.
So, any simple method to do this?
you cant sent an email without an smtp Server. because the smtp Server is the object in the chain that SENDS the email :) and the IIS doesnt implement smtp Server functionality
SMTPClient -> SMTPServer Sender -> SMTP Server Reciever -> POP -> Email CLient
There are several relay smtp Server without smtp-auth out there but i recommend you to avoid the use of them because else YOU will be marked as spam pretty sure.
i created a mail server for myself using hmail + roundcube + windows server 2008 - r2 installed on a vps!
every thing is ok about them and now i want to fetch emails from a specific email address created in hmail!
how can i read all those inbox emails?
thanks in advance
I would recommend using an IMAP library similar to this one featured in this post: http://www.codeproject.com/Articles/8008/IMAP-Client-library-using-C. Using IMAP your code will simply login to your server, in a similar fashion to a mail client and be able to access the mail box and mail. This specific library will allow you to return the mail message as an XML payload for you to process.
How to send Mail using PostMark SMTP server using Sytem.Net.Mail ?
I don't want to use there API I have up and running code which was earlier using Gmail SMTP to send out my mails .But due to mass mailing I needed PostMark.
Did you look into their documentation?
http://developer.postmarkapp.com/developer-smtp.html
-It's all there, I think...
I have an email application where a user can fill out a form and the info get's mail to the form admin. I have the correct server and email credentials being set and i do not get any errors when the mail is sent. The To and From addresses are the same (admin#thedomain.com) It is like the mail is somewhere in limbo. I know the email account works, because I send mail to it from outlook. Any thoughts?
update:
Regarding code, I have created an abstraction to the System.Net.Mail.SmtpClient class. I can set another server and the code works. The server that does work is within my host’s network. The server that does not work is outside of the network. Strange thing is, like I said, I can setup the account in OutLook and I can send / receive mail fine. I’ll have to check with my vendor to see if the mail is indeed getting to their server.
My guess is permissions. Can your app send an email to your address?
I believe .net's system.web.mail sends email via relay. You need to check with your email admin to determine if your IP address is allowed on the server to relay mail.
It turned out to be a DNS issue with my hosting company. I could send mail via outlook becuase I was direclty connecting to the mail servers. The MX records were screwed up. Thanks to all who looked