[Mono-list] Sending email via gmx in C#

pfj pjohnson1 at uclan.ac.uk
Wed Feb 17 06:04:00 EST 2010


Hi,

Currently my code looks like this

void SendClick(object sender, EventArgs e)
		{
			string un = uname + "@" + address;
			string ipa = "IP address sent from : " + ip.Text;
			StreamWriter sw = new StreamWriter(@"h:/test.txt");
			sw.WriteLine(name);
			sw.WriteLine(un);
			sw.WriteLine(mess);
			sw.WriteLine(ipa);
			sw.Close();
			
			MailMessage mail = new MailMessage();
			mail.To.Add("paul at foundationcampus.com");
			mail.From = new System.Net.Mail.MailAddress(un);
			mail.Subject = "A quick test";
			mail.Body = "Just a quick test to make sure this works";
			mail.Attachments.Add(new Attachment(@"h:/test.txt")); 
			System.Net.Mail.SmtpClient smtp = new
System.Net.Mail.SmtpClient("mail.gmx.com");
			smtp.EnableSsl = true;
			smtp.Credentials = new System.Net.NetworkCredential("username at gmx.com",
"password");
			try
			{
				smtp.Send(mail);
			}
			catch (System.Net.Mail.SmtpException ex)
			{
				MessageBox.Show(ex.Message.ToString(), "Ouchy!!!",
MessageBoxButtons.OK);
			}
		}

This should work happily, but I always get an error thrown -

"Mailbox unavailable. The server response was 5.7.0 Sender address does not
belong to logged in user {mp-eu001}"

According to the docs for gmx, I'm doing this correctly.

Is my code wrong or is there something else I need to do for gmx to play
ball?

Thanks

Paul
-- 
View this message in context: http://n4.nabble.com/Sending-email-via-gmx-in-C-tp1558501p1558501.html
Sent from the Mono - General mailing list archive at Nabble.com.


More information about the Mono-list mailing list