473,396 Members | 1,758 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

strange mail problem

When I hardcode a MailMessage To property:
strEmailTo="ju*********@hotmail.com";
it successfully sends the email.

However, when I read the property from a database query
(strEmailTo =myReader["email"].ToString();) it doesn't
send the email and I don't get an error message. The
email just never arrives. I'm displaying the variable
strEmailTo on the screen, so it's definitely set
properly. Any suggestions? The code is below. TIA, John.

strEmailTo =myReader["email"].ToString();

//Email new affiliate
account is now active.\n";

MailMessage msg = new MailMessage();
msg.To = strEmailTo;
msg.From="as*@asd.com";
msg.From = strEmailFrom.ToString().Trim();
msg.Subject = "sdffsfdm";//strEmailSubject;
msg.Body = strEmailBody;

SmtpMail.SmtpServer="mail.megapathdsl.net";
SmtpMail.Send(msg);

lblEmailTo.Text=strEmailTo;

Jul 21 '05 #1
1 1405
"John McD" <ju*********@hotmail.com> wrote in message news:<68****************************@phx.gbl>...
When I hardcode a MailMessage To property:
strEmailTo="ju*********@hotmail.com";
it successfully sends the email.

However, when I read the property from a database query
(strEmailTo =myReader["email"].ToString();) it doesn't
send the email and I don't get an error message. The
email just never arrives. I'm displaying the variable
strEmailTo on the screen, so it's definitely set
properly. Any suggestions? The code is below. TIA, John.

John -

Have you tried watching the SMTP session from the PC running the
application to see what is happening? You can load the free WinPcap
driver and Analyzer program
(http://netgroup-serv.polito.it/netgroup/tools.html) and monitor TCP
port 25 traffic. You should be able to see what is being sent in the
"RCPT TO:" SMTP command, and if the remote SMTP server you specified
accepts the message for delivery. Good luck.

Rich Blum - Author
"C# Network Programming" (Sybex)
http://www.sybex.com/sybexbooks.nsf/Booklist/4176
"Network Performance Open Source Toolkit" (Wiley)
http://www.wiley.com/WileyCDA/WileyT...471433012.html
Jul 21 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

10
by: Carlos Ribeiro | last post by:
Hello all. I'm sending this to the list because I would like to know if someone else has ever stumbled across this one, and also because one possible solution is to patch, or simply "decorate",...
2
by: vamsikrishna_b | last post by:
Hello all,the following problem i encountered while transferring data(mail ids) from MS-outlook to one application.Some mail ids after came into the application looked as strange characters.Eg are...
1
by: seemanta dutta | last post by:
Hi, I have a simple form which when clicked mails a user via the cgi script. But the problem is that when I run the script from the commandline it works well. but the moment I try to do it via...
2
by: Henok Girma | last post by:
Hello Gurus, i have a very strange problem that is killing me.. I have a stored procedure that e-mails, that stored procedure is called from diffrent table triggers.. on table a the trigers...
6
by: Mike the Canadian | last post by:
I am having a very strange problem sending email with php. I have two domains. I can send an email to one domain using php but not the other. If I put both email addresses in the mail command only...
1
by: John | last post by:
Hi First of all apologies for posting so much code but this is rather involved and I am totally stumped. Basically I have a main form (Staff Batch SMS/E-Mail) which calls a function (SendSMS) in...
11
by: Marlene Stebbins | last post by:
Something very strange is going on here. I don't know if it's a C problem or an implementation problem. The program reads data from a file and loads it into two arrays. When xy, x, y, *xlist and...
8
by: Spam Trap | last post by:
I am getting strange resizing problems when using an inherited form. Controls are moving themselves seemingly randomly, but reproducibly. "frmBase" is my base class (a windows form), and...
4
by: Nate Murray | last post by:
Hey all, I'm having a strange PHP (4.3.10) problem that seems to have something to do with javascript. This is a bit complex, so hold on to your hats. My issue is that a single function is...
0
by: RickVidallon | last post by:
Missing or Truncated Body Text in Email Application - 2 Strange Examples... There is no earthly reason why this is happening! EXAMPLES HERE: http://65.36.227.70/actmailer/ We have a...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.