ASPForums.Net RSS Feedhttp://www.aspforums.net/Handlers/RSS.ashxLatest additions to the content that appears on ASPForums.Net(c) 2019 www.aspforums.com. All rights reserved.C# ReSend email with details and link after adding record by user<p>Hi msimoo,</p> <p>Replace the below line of code</p> <p>From</p> <blockquote><cite>msimoo says:</cite> <div class="line number212 index211 alt1"><code class="csharp keyword">string</code> <code class="csharp plain">userEmail = </code><code class="csharp keyword">string</code><code class="csharp plain">.Empty;</code></div> <div class="line number213 index212 alt2"><code class="csharp spaces">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</code><code class="csharp keyword">string</code> <code class="csharp plain">ADSID = </code><code class="csharp keyword">string</code><code class="csharp plain">.Empty;</code></div> <div class="line number214 index213 alt1">&nbsp;</div> <div class="line number215 index214 alt2">&nbsp;</div> <div class="line number216 index215 alt1"><code class="csharp spaces">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</code><code class="csharp keyword">using</code> <code class="csharp plain">(SqlCommand SendMailcmd = </code><code class="csharp keyword">new</code> <code class="csharp plain">SqlCommand(</code><code class="csharp string">"SELECT QAdsEmail, AdsID FROM ads WHERE Email = @Email"</code><code class="csharp plain">))</code></div> <div class="line number217 index216 alt2"><code class="csharp spaces">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</code><code class="csharp plain">{</code></div> <div class="line number218 index217 alt1"><code class="csharp spaces">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</code><code class="csharp plain">SendMailcmd.Parameters.AddWithValue(</code><code class="csharp string">"@Email"</code><code class="csharp plain">, QuickAdsEmailTxtBox.Text.Trim());</code></div> <div class="line number219 index218 alt2"><code class="csharp spaces">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</code><code class="csharp plain">SendMailcmd.Connection = cn;</code></div> <div class="line number220 index219 alt1"><code class="csharp spaces">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</code><code class="csharp plain">cn.Open();</code></div> <div class="line number221 index220 alt2"><code class="csharp spaces">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</code><code class="csharp keyword">using</code> <code class="csharp plain">(SqlDataReader sdr = SendMailcmd.ExecuteReader())</code></div> <div class="line number222 index221 alt1"><code class="csharp spaces">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</code><code class="csharp plain">{</code></div> <div class="line number223 index222 alt2"><code class="csharp spaces">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</code><code class="csharp keyword">if</code> <code class="csharp plain">(sdr.Read())</code></div> <div class="line number224 index223 alt1"><code class="csharp spaces">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</code><code class="csharp plain">{</code></div> <div class="line number225 index224 alt2"><code class="csharp spaces">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</code><code class="csharp plain">username = sdr[</code><code class="csharp string">"UID"</code><code class="csharp plain">].ToString();</code></div> <div class="line number226 index225 alt1"><code class="csharp spaces">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</code><code class="csharp plain">password = sdr[</code><code class="csharp string">"Password"</code><code class="csharp plain">].ToString();</code></div> <div class="line number227 index226 alt2"><code class="csharp spaces">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</code><code class="csharp plain">}</code></div> <div class="line number228 index227 alt1"><code class="csharp spaces">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</code><code class="csharp plain">}</code></div> <div class="line number229 index228 alt2"><code class="csharp spaces">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</code><code class="csharp plain">cn.Close();</code></div> <div class="line number230 index229 alt1"><code class="csharp spaces">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</code><code class="csharp plain">}</code></div> <div class="line number231 index230 alt2">&nbsp;</div> <div class="line number232 index231 alt1"><code class="csharp spaces">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</code><code class="csharp keyword">if</code> <code class="csharp plain">(!</code><code class="csharp keyword">string</code><code class="csharp plain">.IsNullOrEmpty(password))</code></div> <div class="line number233 index232 alt2"><code class="csharp spaces">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</code><code class="csharp plain">{</code></div> <div class="line number234 index233 alt1">&nbsp;</div> <div class="line number235 index234 alt2"><code class="csharp spaces">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</code><code class="csharp plain">MailMessage mm = </code><code class="csharp keyword">new</code> <code class="csharp plain">MailMessage(</code><code class="csharp string">"autoreply@berava.com"</code><code class="csharp plain">, QuickAdsEmailTxtBox.Text.Trim());</code></div> <div class="line number236 index235 alt1"><code class="csharp spaces">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</code><code class="csharp plain">mm.Subject = </code><code class="csharp string">"Welcome to Berava"</code><code class="csharp plain">;</code></div> <div class="line number237 index236 alt2"><code class="csharp spaces">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</code><code class="csharp plain">mm.Body = </code><code class="csharp keyword">string</code><code class="csharp plain">.Format(</code><code class="csharp string">"Hello {0},&lt;br /&gt;&lt;br /&gt;We are so happy using Berava, now you can edit or delete your ads by click on below link:&lt;br /&gt;HERE ENTER THE LINK&lt;br /&gt;&lt;br /&gt;If you have any inquiries please do not hesitate to contact us via our contact form at Berava.com, or you can send it on: info@berava.com&lt;br /&gt;&lt;br /&gt; Have a happy time with Berava.&lt;br /&gt;&lt;br /&gt;Berava team&lt;br /&gt;&lt;br /&gt;&lt;img src='<a href="http://www.berava.com/images/general/logo.png">http://www.berava.com/images/general/logo.png</a>'&gt;"</code><code class="csharp plain">, username, password);</code></div> <div class="line number238 index237 alt1"><code class="csharp spaces">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</code><code class="csharp plain">mm.IsBodyHtml = </code><code class="csharp keyword">true</code><code class="csharp plain">;</code></div> <div class="line number239 index238 alt2"><code class="csharp spaces">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</code><code class="csharp plain">SmtpClient smtp = </code><code class="csharp keyword">new</code> <code class="csharp plain">SmtpClient();</code></div> <div class="line number240 index239 alt1"><code class="csharp spaces">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</code><code class="csharp plain">smtp.Host = </code><code class="csharp string">"smtpout.secureserver.net"</code><code class="csharp plain">;</code></div> <div class="line number241 index240 alt2"><code class="csharp spaces">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</code><code class="csharp plain">smtp.EnableSsl = </code><code class="csharp keyword">false</code><code class="csharp plain">;</code></div> <div class="line number242 index241 alt1"><code class="csharp spaces">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</code><code class="csharp plain">NetworkCredential NetworkCred = </code><code class="csharp keyword">new</code> <code class="csharp plain">NetworkCredential();</code></div> <div class="line number243 index242 alt2"><code class="csharp spaces">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</code><code class="csharp plain">NetworkCred.UserName = </code><code class="csharp string">"autoreply@berava.com"</code><code class="csharp plain">;</code></div> <div class="line number244 index243 alt1"><code class="csharp spaces">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</code><code class="csharp plain">NetworkCred.Password = </code><code class="csharp string">"PASS"</code><code class="csharp plain">;</code></div> <div class="line number245 index244 alt2"><code class="csharp spaces">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</code><code class="csharp plain">smtp.UseDefaultCredentials = </code><code class="csharp keyword">true</code><code class="csharp plain">;</code></div> <div class="line number246 index245 alt1"><code class="csharp spaces">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</code><code class="csharp plain">smtp.Credentials = NetworkCred;</code></div> <div class="line number247 index246 alt2"><code class="csharp spaces">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</code><code class="csharp plain">smtp.Port = 80;</code></div> <div class="line number248 index247 alt1"><code class="csharp spaces">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</code><code class="csharp plain">smtp.Send(mm);</code></div> <div class="line number249 index248 alt2">&nbsp;</div> <div class="line number250 index249 alt1"><code class="csharp spaces">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</code><code class="csharp plain">}</code></div> </blockquote> <p>&nbsp;To</p> <pre class="brush: csharp">string userEmail = string.Empty; string ADSID = string.Empty; using (SqlCommand SendMailcmd = new SqlCommand(&#34;SELECT QAdsEmail, AdsID FROM ads WHERE Email = @Email&#34;)) { SendMailcmd.Parameters.AddWithValue(&#34;@Email&#34;, QuickAdsEmailTxtBox.Text.Trim()); SendMailcmd.Connection = cn; cn.Open(); using (SqlDataReader sdr = SendMailcmd.ExecuteReader()) { if (sdr.Read()) { userEmail = sdr[&#34;QAdsEmail&#34;].ToString(); ADSID = sdr[&#34;AdsID&#34;].ToString(); } } cn.Close(); } if (!string.IsNullOrEmpty(ADSID)) { MailMessage mm = new MailMessage(&#34;autoreply@berava.com&#34;, QuickAdsEmailTxtBox.Text.Trim()); mm.Subject = &#34;Welcome to Berava&#34;; string body = &#34;Hello &#34; + userEmail + &#34;,&#34;; body += &#34;&lt;br /&gt;&lt;br /&gt;We are so happy using Berava, now you can edit or delete your ads by click on below link:&#34;; body += &#34;&lt;br /&gt;&lt;a href = &#39;&#34; + &#34;http://www.berava.com/EditAds.aspx?AID=&#34; + ADSID + &#34;&#39;&gt;Click here to edit or delete.&lt;/a&gt;&#34;; body += &#34;&lt;br /&gt;&lt;br /&gt;If you have any inquiries please do not hesitate to contact us via our contact form at Berava.com, or you can send it on: info@berava.com&lt;br /&gt;&lt;br /&gt; Have a happy time with Berava.&lt;br /&gt;&lt;br /&gt;Berava team&lt;br /&gt;&lt;br /&gt;&lt;img src=&#39;http://www.berava.com/images/general/logo.png&#39;&gt;&#34;; mm.Body = body; mm.IsBodyHtml = true; SmtpClient smtp = new SmtpClient(); smtp.Host = &#34;smtpout.secureserver.net&#34;; smtp.EnableSsl = false; NetworkCredential NetworkCred = new NetworkCredential(); NetworkCred.UserName = &#34;autoreply@berava.com&#34;; NetworkCred.Password = &#34;PASS&#34;; smtp.UseDefaultCredentials = true; smtp.Credentials = NetworkCred; smtp.Port = 80; smtp.Send(mm); }</pre> <p>&nbsp;</p> <p>&nbsp;</p>https://www.aspforums.net:443/Threads/156678/C-ReSend-email-with-details-and-link-after-adding-record-by-user/https://www.aspforums.net:443/Threads/156678/C-ReSend-email-with-details-and-link-after-adding-record-by-user/Mon, 04 Apr 2016 02:48:28 GMTC# ReSend email with details and link after adding record by user<p>Hi @<a class="username" rel="dharmendr">dharmendr</a></p> <p>Many thanks for your help, but for some reasons i dont know what they are it doesnt work. Its not from email server becuase i use below code in another page which is working fine</p> <p>&nbsp;</p> <pre class="brush: csharp">try { MailMessage mailMsg = new MailMessage(); mailMsg.From = new MailAddress(&#34;info@berava.com&#34;); mailMsg.To.Add(&#34;info@berava.com&#34;); mailMsg.Subject = msgtitltxtbx.Text; mailMsg.Body = &#34;&lt;br&gt;Sender Name: &lt;/b&gt;&#34; + nametxtbx.Text + &#34;&lt;br/&gt;&#34; + &#34;&lt;b&gt;Sender Email : &lt;/b&gt;&#34; + nametxtbx.Text + &#34;&lt;/br&gt;&#34; + messagetxtbx.Text; mailMsg.IsBodyHtml = true; SmtpClient smtp = new SmtpClient(); smtp.Host = &#34;smtpout.secureserver.net&#34;; smtp.EnableSsl = false; NetworkCredential NetworkCred = new NetworkCredential(); NetworkCred.UserName = &#34;info@berava.com&#34;; NetworkCred.Password = &#34;pass&#34;; smtp.UseDefaultCredentials = true; smtp.Credentials = NetworkCred; smtp.Port = 80; smtp.Send(mailMsg); conflbl.ForeColor = System.Drawing.Color.Green; conflbl.Text = &#34;Thank you, your message has been successfully sent to us&#34;; nametxtbx.Text = &#34;&#34;; txtbxemail.Text = &#34;&#34;; msgtitltxtbx.Text = &#34;&#34;; messagetxtbx.Text = &#34;&#34;; } catch { conflbl.ForeColor = System.Drawing.Color.Green; conflbl.Text = &#34;Sorry, there is unkown problem, please try later or send your message to: info@berava.com&#34;; } }</pre> <p>&nbsp;</p>https://www.aspforums.net:443/Threads/156678/C-ReSend-email-with-details-and-link-after-adding-record-by-user/https://www.aspforums.net:443/Threads/156678/C-ReSend-email-with-details-and-link-after-adding-record-by-user/Mon, 04 Apr 2016 14:27:05 GMTC# ReSend email with details and link after adding record by user<p>Hi <a class="username" rel="msimoo"> msimoo</a>,</p> <p>As you are using godaddy account try to change the port no to default i.e. 25. Else refer the below link.</p> <h1><a class="question-hyperlink" href="http://stackoverflow.com/questions/1317809/sending-email-using-a-godaddy-account">Sending email using a godaddy account</a></h1> <p>Still if your problem not resolve then You need to contact GoDaddy Support and get proper email settings for your account.</p>https://www.aspforums.net:443/Threads/156678/C-ReSend-email-with-details-and-link-after-adding-record-by-user/https://www.aspforums.net:443/Threads/156678/C-ReSend-email-with-details-and-link-after-adding-record-by-user/Tue, 05 Apr 2016 02:27:20 GMT