0

So I have access to a SP 2010 website but am developing another stand alone, non SP website on the same domain.

I haven't been given a mailer or an sql box so I've been using custom lists, an api and csom to load data from SP for this new site. I would love to also be able to use this SP box in the same way to send email.

I have tried several different ways but they all fail, making me wonder if I can even do this at all.

Anyone have any idea whether this is possible?

0

I think you could use System.Net.Mail.SmtpClient to send email. Sample code:

MailMessage mail = new MailMessage();
            SmtpClient SmtpServer = new SmtpClient("smtp.gmail.com");

            mail.From = new MailAddress("me@mydomain.com");
            mail.To.Add("u@urdomain.com");
            mail.Subject = filename;
            mail.Body = "Report";
            Attachment attachment = new Attachment(filename);
            mail.Attachments.Add(attachment);

            SmtpServer.Port = 25;
            SmtpServer.Credentials = new System.Net.NetworkCredential("me", "password");
            SmtpServer.EnableSsl = true;

            SmtpServer.Send(mail);

Some links for your reference:

https://www.codeproject.com/Questions/339835/Send-Email-using-SMTP-in-Csharp

https://msdn.microsoft.com/en-us/library/system.net.mail.smtpclient(v=vs.110).aspx

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.