SMTP Host

J

Jonathan Wood

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.
 
M

Mohamad Elarabi

You don't need a user name and password in most cases if you just want to
send an email. All you need is an IP address, and a port (usually 25) of a
mail server (SMTP service) that would allow you to relay through it.

Usually the Hosting company has that information, so your clients may not
even know it.

To give you an example, I could send emails through a mail server titled
mail.abc123.com, as (e-mail address removed) (a completely different domain). The
server you're sending from doesn't need to be related to the server you
recieve emails on. It just needs to allow you to send through it. That is
called Relaying emails, or allowing relay.

In code, you usually specify an IP address, and a port. Or a FQDN (i.e.
mail.yahoo.com) and a port. In some cases you would be required to pass a
username and password so you can relay through a certain server.

This doesn't exactly fit in this group but I'm assuming you don'y know what
info is needed to send emails in .Net.
 
B

Barrie Wilson

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?

the ones I've used have all had SMTP service available; I wouldn't use them
if they didn't
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.

I usually request their admin to set up an application email account with
its own uid/pwd; I really don't ever want to know any user passwords if I
don't have to; some organizations have **extremely** strict prohibitions on
"lending" passwords or using them if it's not yours
 
M

Mark Rae [MVP]

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?

Your ISP should provide an STMP queue which you can relay through - if they
don't, then find a decent ISP...

E.g. www.hostinguk.net provide a mail server with an SMTP queue at
relay.hostinguk.net which can be used for this purpose:
http://www.support.hostinguk.net/mail/default.htm, but only from within
their internal network, which means no username and password are required...
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.

Shouldn't be necessary...
 
R

Robert Silver

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(duplicateConfirmationEmail);
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
 
B

Braulio Diez

In some cases you will find that you can just send e-mails from the web
server, no need for authentication (the server it sleft it's autohorized to
rely on a given smtp server).

More often you have to use user and password, I would ask the client what's
the case. To check if server and user and password are valid without having
to code .net try:

http://msexchangeteam.com/archive/2006/07/14/428324.aspx

For testing purposes you can rely on GMail to do some simple development
tests:

http://www.codeproject.com/KB/cs/SendMailUsingGmailAccount.aspx

More info about SMTP and .net

http://www.tipsdotnet.com/ArticleBlog.aspx?KWID=45&Area=SMTP&PageIndex=0

Good luck
Braulio



/// ------------------------------
/// Braulio Diez
///
/// http://www.tipsdotnet.com
/// ------------------------------
 
S

sloan

They (the isp) should provide you with some smtp server and perhaps
credentials.

...


In my "introduction letter" I got from my hosting service, they provided me
the smtp server name.

If you want a quick and easy configuration answer to different smtp
servers...then go there:

http://sholliday.spaces.live.com/blog/cns!A68482B9628A842A!138.entry


The code is downloadable. And if you setup a free gmail account, you can
even experiment with that.
 
S

Scott Roberts

Using an unprotected "relay" server for sending mail is a great way to have
all of your emails deposited directly into the recipient's Junk Mail folder.
 
B

Barrie Wilson

Using an unprotected "relay" server for sending mail is a great way to
have all of your emails deposited directly into the recipient's Junk Mail
folder.

people should also keep in mind that if you run your own mail server
operating on a dynamic IP some hosts will reject mail from it, even if it
doesn't relay promiscuously ... your address block is effectively
black-listed ....
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,070
Latest member
BiogenixGummies

Latest Threads

Top