|
web
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Question about sending email via Visual Basic 2005 on a ASP.NET paI am hoping a couple of you will have some ideas on this one... I have a webform created in visual basic 2005. Basically, the webform gather answers to the questions asked on the form and included a couple free type multine textboxes. When the user presses submit an message is created with the responses and fired off to a MS Exchange mail enabled public folder. This is an external webform btw, not used by internal users. Problem: After some fighting, I have the mail message formatted pretty as it was requested and I have it coming in HTML form: MailMessage.IsBodyHtml = True For the most part. My hang up is the couple free text multi line text boxes don't word wrap so well (all the time). When I view them, using MS Outlook 2007 those sections word wrap just fine in the public folder post. However, are admins in the other sections, using MS Outlook 2003, do not show the word wrap. Outlook 2007 on my pc and Outlook 2003 on their pc are set to view messages in HTML mode. As far as I can tell, other then being different versions - are settings are similar. Not sure if there is something I could do programmatically to get around this issue or not? Again, everything seems great - except those couple multiline text box objects.... I tried playing around with the html <PRE> tags and that didn't even help. I been digging through blogs and other posts for about 2 hours now - no luck. Anyone have any ideas? On Apr 30, 1:54 pm, Tony Wissler <Tony
Wiss***@discussions.microsoft.com> wrote: Show quoteHide quote > Hello everyone- I might embarrass myself with this on-the-fly Regex pattern, but here> > I am hoping a couple of you will have some ideas on this one... > > I have a webform created in visual basic 2005. > Basically, the webform gather answers to the questions asked on the form and > included a couple free type multine textboxes. > > When the user presses submit an message is created with the responses and > fired off to a MS Exchange mail enabled public folder. > > This is an external webform btw, not used by internal users. > > Problem: > After some fighting, I have the mail message formatted pretty as it was > requested and I have it coming in HTML form: MailMessage.IsBodyHtml = True > For the most part. > > My hang up is the couple free text multi line text boxes don't word wrap so > well (all the time). > When I view them, using MS Outlook 2007 those sections word wrap just fine > in the public folder post. However, are admins in the other sections, using > MS Outlook 2003, do not show the word wrap. > > Outlook 2007 on my pc and Outlook 2003 on their pc are set to view messages > in HTML mode. As far as I can tell, other then being different versions - > are settings are similar. > > Not sure if there is something I could do programmatically to get around > this issue or not? > > Again, everything seems great - except those couple multiline text box > objects.... > > I tried playing around with the html <PRE> tags and that didn't even help. > > I been digging through blogs and other posts for about 2 hours now - no luck. > > Anyone have any ideas? it goes: You could use regex to match the text in each line of the multiline textbox, then add a <br /> tag to the end of each line. This assumes an Imports System.Text.RegularExpressions: ' This is typed in the message so it may contain errors Dim output as String = "" For Each m as Match in Regex.Matches(me.TextBox1.Text, "(?=[^\r \n]).*(?<![\r\n])", RegexOptions.Multiline)) output &= String.Format("{0}<br />", m.Value) Next ' Then just use the "output" string in your email Thanks, Seth Rowe
Show quote
Hide quote
"rowe_newsgroups" <rowe_em***@yahoo.com> wrote in message Perhaps I didn't fully understand the question, but I'm doing something news:1177958321.511000.253020@l77g2000hsb.googlegroups.com... > On Apr 30, 1:54 pm, Tony Wissler <Tony > Wiss***@discussions.microsoft.com> wrote: >> Hello everyone- > You could use regex to match the text in each line of the multiline > textbox, then add a <br /> tag to the end of each line. > > This assumes an Imports System.Text.RegularExpressions: > > ' This is typed in the message so it may contain errors > > Dim output as String = "" > For Each m as Match in Regex.Matches(me.TextBox1.Text, "(?=[^\r > \n]).*(?<![\r\n])", RegexOptions.Multiline)) > output &= String.Format("{0}<br />", m.Value) > Next > ' Then just use the "output" string in your email similar myself and what worked for me was to simply scan for vbcrlf in the textbox text and then replace with both a duplicate vbcrlf and a <br> tag. I'm still new to email creation, but this seems to permit the proper viewing by both html enabled email software that seems to ignore the vbcrlf and by plain-text only software the ignores the html tags. It is similar in function to the above, but much easier to code. My code is below Msg = Replace(Msg, vbCrLf, vbCrLf & "<br>") Jeff Jeff-
Thanks for the info, I gave this a try and it worked great for what I wanted to do. The formatting looks good now in both MS Outlook 2007 and MS Outlook 2003. Regular Expressions is probably the best way (as mentioned above), but I went this route for ease of readability and I am not concerned about speed on this particular web form as I don't see the traffic being that extreme. Thanks- Tony Wissler Show quoteHide quote "Jeff" wrote: > > "rowe_newsgroups" <rowe_em***@yahoo.com> wrote in message > news:1177958321.511000.253020@l77g2000hsb.googlegroups.com... > > On Apr 30, 1:54 pm, Tony Wissler <Tony > > Wiss***@discussions.microsoft.com> wrote: > >> Hello everyone- > > You could use regex to match the text in each line of the multiline > > textbox, then add a <br /> tag to the end of each line. > > > > This assumes an Imports System.Text.RegularExpressions: > > > > ' This is typed in the message so it may contain errors > > > > Dim output as String = "" > > For Each m as Match in Regex.Matches(me.TextBox1.Text, "(?=[^\r > > \n]).*(?<![\r\n])", RegexOptions.Multiline)) > > output &= String.Format("{0}<br />", m.Value) > > Next > > ' Then just use the "output" string in your email > > Perhaps I didn't fully understand the question, but I'm doing something > similar myself and what worked for me was to simply scan for vbcrlf in the > textbox text and then replace with both a duplicate vbcrlf and a <br> tag. > I'm still new to email creation, but this seems to permit the proper viewing > by both html enabled email software that seems to ignore the vbcrlf and by > plain-text only software the ignores the html tags. > > It is similar in function to the above, but much easier to code. My code is > below > > Msg = Replace(Msg, vbCrLf, vbCrLf & "<br>") > > Jeff > > > > > -- > Posted via a free Usenet account from http://www.teranews.com > >
Show quote
Hide quote
"Tony Wissler" <TonyWiss***@discussions.microsoft.com> wrote in message Umm, the first time that I successfully actually answered a question for news:9367D7F4-BE9D-4B13-A66E-39CA6FB487FC@microsoft.com... > Jeff- > > Thanks for the info, I gave this a try and it worked great for what I > wanted > to do. > The formatting looks good now in both MS Outlook 2007 and MS Outlook 2003. > > Regular Expressions is probably the best way (as mentioned above), but I > went this route for ease of readability and I am not concerned about speed > on > this particular web form as I don't see the traffic being that extreme. > > Thanks- > > Tony Wissler someone else rather than the other way around. I must be learning something - it's a scary thought. Jeff Seth-
Thank you for the info! I did a test and the regular expression road you pointed me down does work, but I initally tried to steer clear of regular expressions due to the difficulty in someone else just taking a look at it later and being able to easily read it. I choose another option, giving up perhaps the better way for readability. I know regular expressions is probably the best way and I need get more familar with them, but perhaps I will drive that road in another couple months. Thanks- Tony Wissler Show quoteHide quote "rowe_newsgroups" wrote: > On Apr 30, 1:54 pm, Tony Wissler <Tony > Wiss***@discussions.microsoft.com> wrote: > > Hello everyone- > > > > I am hoping a couple of you will have some ideas on this one... > > > > I have a webform created in visual basic 2005. > > Basically, the webform gather answers to the questions asked on the form and > > included a couple free type multine textboxes. > > > > When the user presses submit an message is created with the responses and > > fired off to a MS Exchange mail enabled public folder. > > > > This is an external webform btw, not used by internal users. > > > > Problem: > > After some fighting, I have the mail message formatted pretty as it was > > requested and I have it coming in HTML form: MailMessage.IsBodyHtml = True > > For the most part. > > > > My hang up is the couple free text multi line text boxes don't word wrap so > > well (all the time). > > When I view them, using MS Outlook 2007 those sections word wrap just fine > > in the public folder post. However, are admins in the other sections, using > > MS Outlook 2003, do not show the word wrap. > > > > Outlook 2007 on my pc and Outlook 2003 on their pc are set to view messages > > in HTML mode. As far as I can tell, other then being different versions - > > are settings are similar. > > > > Not sure if there is something I could do programmatically to get around > > this issue or not? > > > > Again, everything seems great - except those couple multiline text box > > objects.... > > > > I tried playing around with the html <PRE> tags and that didn't even help. > > > > I been digging through blogs and other posts for about 2 hours now - no luck. > > > > Anyone have any ideas? > > I might embarrass myself with this on-the-fly Regex pattern, but here > it goes: > > You could use regex to match the text in each line of the multiline > textbox, then add a <br /> tag to the end of each line. > > This assumes an Imports System.Text.RegularExpressions: > > ' This is typed in the message so it may contain errors > > Dim output as String = "" > For Each m as Match in Regex.Matches(me.TextBox1.Text, "(?=[^\r > \n]).*(?<![\r\n])", RegexOptions.Multiline)) > output &= String.Format("{0}<br />", m.Value) > Next > ' Then just use the "output" string in your email > > Thanks, > > Seth Rowe > >
Help with delegate callback error
Strange Date Problem there is no 64-bit Jet (MS Access) OLEDB driver. Problem with: Use the following method to smooth edges of screen fonts: if ClearType is selected COM problem Publishing problem a vb calculator, but with a twist.?? Can someone help me with this menu? Send keystroke to a datagridview control Forms |
|||||||||||||||||||||||