View Complete Post
Hi I have a annoying problem. I have created a page which takes users details for a quote.
I have then created the form to be emailed to both the user and myself. (Which works fine ATM)
However I would also like to be able to attach a file containing terms and conditions to the email.
I have tried doing this using
But everytime that line of code is hit it fails and is caught by my try catch.
Take that line out and the email sends fine, put it in and it breaks the whole page.
Am I missing something really obvious?
Ok here's my problem. I have a contact page with a txtbox for users name, email and message for users to contact me. When I send the message it goes through, but the senders email is always my email. Even though i have set it to the txtEmail.Text property. So when I reply, it sends me an email. What am I not seeing that I messed up. Also this is running from VS 2005.
protected void btnSubmit_Click1(object sender, ImageClickEventArgs e)
const string toAddress = "firstname.lastname@example.org";
MailAddress from = new MailAddress(txtEmail.Text, txtName.Text);
MailAddress to = new MailAddress(toAddress, "Admin");
MailMessage message = new MailMessage(from, to);
// set properties
message.Subject = txtName.Text + " has sent you an email!";
message.Body = txtMessage.Text;
message.IsBodyHtml = false;
//create smtp object
SmtpClient client = new SmtpClient();
client.EnableSsl = true;
'System.Net.Mail.SmtpException: Failure sending mail. ---> System.IO.IOException: Unable to read data from the transport connection: net_io_connectionclosed. at System.Net.Mail.SmtpReplyReaderFactory.ProcessRead(Byte buffer, Int32 offset,
Int32 read, Boolean readLine) at System.Net.Mail.SmtpReplyReaderFactory.ReadLines(SmtpReplyReader caller, Boolean oneLine) at System.Net.Mail.SmtpReplyReaderFactory.ReadLine(SmtpReplyReader caller) at System.Net.Mail.SmtpReplyReader.ReadLine()
at System.Net.Mail.CheckCommand.Send(SmtpConnection conn, String& response) at System.Net.Mail.MailCommand.Send(SmtpConnection conn, Byte command, String from) at System.Net.Mail.SmtpTransport.SendMail(MailAddress sender, MailAddressCollection
recipients, String deliveryNotify, SmtpFailedRecipientException& exception) at System.Net.Mail.SmtpClient.Send(MailMessage message) --- End of inner exception stack trace --- at System.Net.Mail.SmtpClient.Send(MailMessage
i tried many things but still awaiting solution
sometimes i get this error
'System.Net.Mail.SmtpException: Failure sending mail. ---> System.Net.WebException: The remote name could not be resolved: 'smtp.mail.y
My goal is to embed a link in the email.
Purpose is that the user needs to click the link in his email to activate the account.
But my emailbody with the link is just shown as plain-Non clickabel text.
the body text looks like:
string mailBody = "please click the following link to activate your account:<br>
string mailBody = "please click the following link to activate your account:<br>" +
I use the follwing code
System.Net.Mail.AlternateView plainView = System.Net.Mail.AlternateView.CreateAlternateViewFromString(System.Text.RegularExpressions.Regex.Replace(BodyText, @"<(.|\n)*?>", string.Empty), null, "text/plain");
System.Net.Mail.AlternateView htmlView = System.Net.Mail.AlternateView.CreateAlternateViewFromString(BodyText.Replace("\n","<BR>"), null , System.Net.Mime.MediaTypeNames.Text.Html);
This is frustrating, and I don't know how to solve it.
I have a strange problem. I am adding a LinqDatasource object, and set the context:
protected void LinqDataSource_ContextCreating(object sender, LinqDataSourceContextEventArgs e)
e.ObjectInstance = new KaruselaDataContext(ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString);
Then I get this error:The type 'System.Data.Linq.DataContext' is defined in an assembly that is not referenced. You must add a reference to assembly 'System.Data.Linq, Version=18.104.22.168, Culture=neutral, PublicKeyToken=b77a5c561934e089'.
On web.config I already have this:<add assembly="System.Data.Linq, Version=22.214.171.124, Culture=neutral, PublicKeyToken=b77a5c561934e089"/>
NOTE: The datacontext is in a different project (DLL proect) where I added a refernce to System.Data.Linq.
is there another way adding a refernce to a web project? or only though teh web.config?
I really need some help (and also some code example), in how to use System.Threading to send emails.
The issue is:
a) I have a function that sends emails;
b) But I don't want to keep the customers waiting for the email being sent;
c) so, I figure it out that the System.Threading is the best way to do that; But I don't know how exactly I cant use it.
PLEASE, i'm VB - not C# - developer, and I really appreciate help in that language.
I can't use Windows Services or SQL Jobs...
Could you help me on this?
I have an array of addresses.....
Protected Function GetData() As String() Dim stringArr(3) As String stringArr(0) = "email@example.com" stringArr(1) = "firstname.lastname@example.org" stringArr(2) = "email@example.com" Return stringArr End FunctionI am getting an error when i run the code in the CC part....please put this in the right syntax..MassMail.CC.Add() .......getdata???
What do I need here ?????? To make this work??
Dim MassMail As New MailMessage()
Dim Template As ??????????????
MassMail.To.Add(New MailAddress(TextBox_massemailto.Text)) MassMail.From = New MailAddress("You@me.com") ' MassMail.CC.Add() MassMail.Subject = TextBox_massemailsubject.Text MassMail.Body = TextBox_massemailBody.Text ' MassMail.Body = Template.BodyFileName = "EmailTemplates/BusinessAdBrochure.htm" MassMail.Priority = MailPriority.High Dim smtpclient As New SmtpClient("relay-hosting.secureserver.net") smtpclient.Credentials = New System.Net.NetworkCredential(""You@me.com"", "pasword") smtpclient.Port = 25 smtpclient.EnableSsl = False smtpclien