Jonathan,
For what it's worth, this is the code that I use to send emails from my code
whilst it's hosted on a server in the US (I'm a UK developer):
string fromMailAddress = [This is passed into to my method];
string emailServer = "smptp.hostingname_goes_here.com";
string hostName = "relay.hostingname_goes_here.com";
string duplicateConfirmationEmail = [From_my_web.config_file]
int portNumber = [Email_port_from_hosting_company_goes_here];
// This can be zero, but sometimes 25
System.Net.Mail.MailAddress fromMail = new
System.Net.Mail.MailAddress(fromMailAddress);
System.Net.Mail.MailAddress toMail = new
System.Net.Mail.MailAddress(custEmailAddress);
System.Net.Mail.MailAddress bccMail = new
System.Net.Mail.MailAddress(duplicateConfirmationE mail);
System.Net.Mail.MailMessage msgDetails = new
System.Net.Mail.MailMessage(fromMail, toMail);
msgDetails.Subject = "Subject goes here;
msgDetails.Body = "Body text here";
msgDetails.IsBodyHtml = true; // With this set you can put
<br/in the body text to get carriage returns etc.
System.Net.Mail.SmtpClient client = new
System.Net.Mail.SmtpClient(emailServer);
if (hostName != "")
{
// I can't send BCC emails whilst the code runs locally or on our internal
servers.
// So I check that the hostname and if set, I'll send the BCC.
msgDetails.Bcc.Add(bccMail);
client.Host = hostName;
}
if (portNumber != 0)
client.Port = portNumber;
client.Send(msgDetails);
Hope it helps.
Robert Silver
"Jonathan Wood" wrote:
I was curious what most people do when they want to send an email from their
Web application, which is hosted on a shared server owned by another
company.
Do you simply specify the SMTP host of your own email account, or do shared
servers typically have services available that can be used for this?
I'm creating an application for a client and am not sure if I should ask
them for their email account information, which I assume includes their
password, etc.
Thanks.
--
Jonathan Wood
SoftCircuits Programming
http://www.softcircuits.com