Web Forms :: Use MailMessage For Bulk Email Using DataTable?
Mar 17, 2010
I know I'm missing something. I'm getting this error when trying to use the script below it. The data I need comes up fine but I don't know how to get it into a loop that works for Bcc. Ideas? If a hard code a single address into bcc it works fine. If I append the body with the datatable records to see if the data is actually there, all the data expected is there.Unable to read data from the transport connection: net_io_connectionclosed.Description:An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.Exception Details: System.IO.IOException: Unable to read data from the transport connection: net_io_connectionclosed.
public void hthSubscriberMail(string subject, string body)
{
string connectionString;
am sending email to the users using smtp client and MailMessage class.i have been adding the addresses of multiple receivers in the to property of the object of MailMessage class. the problem is that the receiver can see the email addresses of other receipents. is there any way to hide the email addresses of other receipents.i mean setting some property or something like that.otherwise i will be left with only option to send individual email to the users.
I am creating a bulk email sending facility for our website.I have got all the email in one table so i know i can use email sending features with one loop that take all the emails from the table and send it to everybody.I would like to give them a link that will opt out them from the list.If anybody has done it recently or know any link please suggest it.
What I am trying to achieve here is, I am supplying xml as string (varchar) to my stored procedure, In stored procedure I want to parse this xml and fetch each Promotion record and insert into my table. Also once each record is inserted, I need to fetch the Identity of that record alongwith the AreaID attribute from the Parent node "Promotion" of each Promotion record and insert into second association table. how would I go about doing it, my generated xml is given as under.
I have a web form which will send bulk email to our site suscribers, they maybe hundreds or even thousands.Is System.Net.Mail optimal for this purpose?
I need to send a info email to a lot of emails in a table I have. I managed to find some code on the internet and I made the connection so that everyone got their email correctly.However I want to display the email recievers their names in the body text. Like "Hi Mr Stark!My code only sets the name of the last name in my table.This is my code:
I am trying to make a confirmation email. The mail should contain data about the customers order.Thought the best solution was to reuse the user control from my confirmation page. But how? The following code only generates a url to the control:
Every morning we send out an email with a text file attached. This is a manual process so I am automating it.I am using an internal mail web service. Its last two parameters are a byte array which is the file contents and a string which is the file name. I passed (...gbytes, "test.txt") and the only thing wrong with it is text.txt is XML. I want it to be text (csv is fine because there is actually four columns that come from a datatable).So I am assuming what's making it XML is this code:
Code: System.IO.MemoryStream stream = new System.IO.MemoryStream(); System.Runtime.Serialization.IFormatter formatter = new System.Runtime.Serialization.Formatters.Binary.BinaryFormatter(); formatter.Serialize(stream, ds.Tables[0]); gbytes = stream.GetBuffer();
I am trying to search the Internet for how to convert a datatable to a byte array, but I can't find how to have it be text instead of XML. Also, another parameter our WS takes is a flag to say if it's XML, and I am setting this to false.
I'm having problems with the "From". No matter what i put in, it is always getting filled out with whatever account i'm using to log into the smtp services. Here is the code.. not sure what i'm doing wrong by the examples I've looked at.
[Code]....
I've checked my mFrom property and it has the correct email address i'm trying to send it from.. Is the from just always filled out with the info that the email is sent from
I have 3 issues that I am attempting to resolve in development with using an aspx page to send email (both internal and external).1. Using the ddl.SelectedValue for the To email address doesn't send the email to the person, but will still cc and bcc the hard-coded recipients. If I replace the(DropListVendor.SelectedValue.Trim()) withmyemail@chuckanddons.com it sends just fine. However I need my users to be able to select which vendor to email, hence the Drop Down list for Vendor. I'll post my code below.
i am trying to send emails using SMTP MailMessage but i have a problems, i got the following error: Failed to send to pm@[URL] (530 5.7.0 Must issue a STARTTLS command first. g31sm24378313ibh.22 ) my code is the following:
I have an ASP.Net app that allows a user to write text into a Telerik RadEditor control and then send an email.
For some reason I'm sometimes getting strange characters showing up in the email that is generated.
For example if I put the word Test's into the RadEditor box and send it... the email shows up with the text changed to: Test’s.
It seems as though the ' character was used in place of ' because if I use the later, the text would show up just fine. If I pull up the saved record within the ASP.Net apps interface it looks just fine. It also appears just fine when I view the text within the recorded of the MS SQL table it was stored in.
I'm using MailMessage to create the email. I've check the string being sent at the point just before I use SmtpClient to send the message and it looks just fine at his point. Once the email message shows up however I get the strange text (Test’s).
I'm guessing that I have an encode/decoding issue but I'm not sure how I would go about fixing this.
Continued--->
I have tried to add it to the constructor of my email class with/without mybase but that had no effect.
Public Sub New(ByVal EmailDate As DateTime, ByVal LogoPath As String) MyBase.New() MyBase.BodyEncoding = Encoding.GetEncoding("iso-8859-1") 'BodyEncoding = Encoding.GetEncoding("iso-8859-1") Me.EmailDate = EmailDate Me.LogoPath = LogoPath End Sub
I also tried adding it to the code behind of the form that calls the email class just before I create a new SmtpClient but that did not seem to be correct either.
Try returnEmail.BodyEncoding = Encoding.GetEncoding("iso-8859-1") Dim smtpCli As New SmtpClient smtpCli.Send(returnEmail) Catch ex As Exception ScriptManager.RegisterStartupScript(Me, Me.GetType, "smtpError", "alert('There was an error sending the email: * " & ex.Message & "');", True) End Try
Is there a way to check if SmtpClient successfully delivered an email? SmtpClient.Send() does not appear to return anything other than an exception. So if the method completes is it safe to assume the email will be successfully sent to the appropriate email box? My code is below:
MailMessage emailMessage = new MailMessage(); emailMessage.Subject = SubjectText; emailMessage.IsBodyHtml = IsBodyHtml; emailMessage.Body = BodyText; emailMessage.From = new MailAddress(Settings.Default.FromEmail,Settings.Default.FromDisplayName); //add recipients foreach (string recipientAddress in RecipientAddresses.Split(new char[{','},StringSplitOptions.RemoveEmptyEntries)) emailMessage.To.Add(recipientAddress); using (SmtpClient smtpClient = new SmtpClient()) { smtpClient.Send(emailMessage); }
If I am passed a datatable and I cant change the column structure..is there anyway to set an existing column to a Primary key so I can easily Find() the row I am looking for?