Can someone explain to me how to send mail in the TheBeerHouse project as a walkthorugh. I have the basic understanding of how it works, but think i got problems with my ISP blocking me sending mail. I want to be able to run the project from my local
computer on the net. Below is my setup. I want to send emails to myself and let my friends send emails from the site to me aswell for testing etc different isp.
1. My ISP is aol.
2. I am running vista ultimate 32 bit version.
3. I am running the project from IIS, but internal ip.
If you are using the existing TheBeerHouse pages (e.g. contact form etc.) to send mail then you just need to configure your smtp settings within web.config.
So you need an smtp server to be able to send the mail. If you already have outlook configured for an AOL email address then you should be able to use the same settings in your web application.
Thanks for the replys. What is the recomended smtp server to use ?. If i use aol for my smtp server with my credentials every email i send for example on my contact page goes to my email addresss but as my name. (myname@aol.com
inputed on contact us page deleviers as myname@aol.com ) but if i do the following i get the same result (myname@yahoo.com inputed on contact us page deleviers as
myname@aol.com ) , because i am using aol credentials. Is there a way around this ?.
You need to configure the TheBeerHouseSection in web.config as:
<contactForm mailTo="info@mydomain.com"
replacing with the email address you want to send to.
The email address used in the smtp settings (previously posted) is just used for authentication.
Then on your contact form code you should have something like:
msg.From = New MailAddress(txtEmail.Text, txtName.Text)
msg.To.Add(New MailAddress(Globals.Settings.ContactForm.MailTo))
This will then send the message from the email address specified on the contact form, to the email you specify in the contact form section in web.config.
This does depend on whether your aol smtp server allows you to send from a non aol domain - many block this.
As for what smtp server to use, it really depends on what your options are. If you pay for web/email hosting then you normally get access to an smtp server as part of the service. However, as you are hosting this yourself it seems your only option is to
use your ISP's smtp server.
Hope this helps,
Ben
Marked as answer by leeward30 on Jan 10, 2009 05:51 PM
leeward30
Member
156 Points
179 Posts
Sending Mail Issues
Jan 05, 2009 02:42 PM|LINK
Hi,
Can someone explain to me how to send mail in the TheBeerHouse project as a walkthorugh. I have the basic understanding of how it works, but think i got problems with my ISP blocking me sending mail. I want to be able to run the project from my local computer on the net. Below is my setup. I want to send emails to myself and let my friends send emails from the site to me aswell for testing etc different isp.
1. My ISP is aol.
2. I am running vista ultimate 32 bit version.
3. I am running the project from IIS, but internal ip.
Many Thanks In Advance
Kered
mitoy75
Member
200 Points
136 Posts
Re: Sending Mail Issues
Jan 05, 2009 03:36 PM|LINK
you can try the following:
you need two aspx pages one to create the email and the other to send the email. hope this helps...
using System;
using
System.Collections;using
System.Configuration;using
System.Data;using
System.Web;using
System.Web.Security;using
System.Web.UI;using
System.Web.UI.HtmlControls;using
System.Web.UI.WebControls;using
System.Web.UI.WebControls.WebParts;using
System.Net.Mail;public
partial class Default1 : System.Web.UI.Page{
private bool SendMail(string from, string body, string subject){
string mailServerName = "your doomain"; MailMessage message = new MailMessage(from, "your email address", subject, body); SmtpClient mailClient = new SmtpClient();mailClient.Host = mailServerName;
mailClient.Send(message);
message.Dispose();
return true;}
protected void Page_Load(object sender, EventArgs e){
}
protected void Send_Click(object sender, EventArgs e){
bool x = SendMail(txtFrom.Text, txtMessage.Text, txtSubject.Text);if (x == true){
Response.Redirect("EMailSent.aspx");}
else{
Label1.Text = "Try Again";}
}
}
mitoy75
Member
200 Points
136 Posts
Re: Sending Mail Issues
Jan 05, 2009 03:36 PM|LINK
you can try the following:
you need two aspx pages one to create the email and the other to send the email. hope this helps...
using System;
using
System.Collections;using
System.Configuration;using
System.Data;using
System.Web;using
System.Web.Security;using
System.Web.UI;using
System.Web.UI.HtmlControls;using
System.Web.UI.WebControls;using
System.Web.UI.WebControls.WebParts;using
System.Net.Mail;public
partial class Default1 : System.Web.UI.Page{
private bool SendMail(string from, string body, string subject){
string mailServerName = "your doomain"; MailMessage message = new MailMessage(from, "your email address", subject, body); SmtpClient mailClient = new SmtpClient();mailClient.Host = mailServerName;
mailClient.Send(message);
message.Dispose();
return true;}
protected void Page_Load(object sender, EventArgs e){
}
protected void Send_Click(object sender, EventArgs e){
bool x = SendMail(txtFrom.Text, txtMessage.Text, txtSubject.Text);if (x == true){
Response.Redirect("EMailSent.aspx");}
else{
Label1.Text = "Try Again";}
}
}
retroviz
Participant
898 Points
249 Posts
Re: Sending Mail Issues
Jan 05, 2009 03:50 PM|LINK
If you are using the existing TheBeerHouse pages (e.g. contact form etc.) to send mail then you just need to configure your smtp settings within web.config.
<system.net> <mailSettings> <smtp from="you@yourdomain.com"> <network host="SMTP SERVER ADDRESS" port="25" userName="USERNAME" password="PASSWORD"> </smtp> </mailSettings> </system.net>So you need an smtp server to be able to send the mail. If you already have outlook configured for an AOL email address then you should be able to use the same settings in your web application.leeward30
Member
156 Points
179 Posts
Re: Sending Mail Issues
Jan 09, 2009 10:31 AM|LINK
Hi,
Thanks for the replys. What is the recomended smtp server to use ?. If i use aol for my smtp server with my credentials every email i send for example on my contact page goes to my email addresss but as my name. (myname@aol.com inputed on contact us page deleviers as myname@aol.com ) but if i do the following i get the same result (myname@yahoo.com inputed on contact us page deleviers as myname@aol.com ) , because i am using aol credentials. Is there a way around this ?.
kered
retroviz
Participant
898 Points
249 Posts
Re: Sending Mail Issues
Jan 09, 2009 10:44 AM|LINK
You need to configure the TheBeerHouseSection in web.config as:
<contactForm mailTo="info@mydomain.com"
replacing with the email address you want to send to.
The email address used in the smtp settings (previously posted) is just used for authentication.
Then on your contact form code you should have something like:
msg.From = New MailAddress(txtEmail.Text, txtName.Text)msg.To.Add(New MailAddress(Globals.Settings.ContactForm.MailTo))
This will then send the message from the email address specified on the contact form, to the email you specify in the contact form section in web.config.
This does depend on whether your aol smtp server allows you to send from a non aol domain - many block this.
As for what smtp server to use, it really depends on what your options are. If you pay for web/email hosting then you normally get access to an smtp server as part of the service. However, as you are hosting this yourself it seems your only option is to use your ISP's smtp server.
Hope this helps,
Ben
leeward30
Member
156 Points
179 Posts
Re: Sending Mail Issues
Jan 10, 2009 05:52 PM|LINK
Hi, Ben
Thanks for your answer it has solved my problem.
Kered