3 Replies - 524 Views - Last Post: 21 January 2010 - 10:48 AM Rate Topic: -----

#1 DarkHeartz  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 2
  • Joined: 21-January 10

I got a small problem with my mail sending test program (smtp problems

Post icon  Posted 21 January 2010 - 07:03 AM

Hey everyone, i just started programming yesterday in C#.
Today was i playing a little with creating a program that should be able to send a email, but im not allowed to send it by my Host, so i need to know, how i can input my username/password so i can pass without getting rejected by my Webhotel/Email host?

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Web;
using System.Net.Mail;
using System.Configuration; 

namespace WindowsFormsApplication1
{
	public partial class Form2 : Form
	{
		public Form2()
		{
			InitializeComponent();
		}

		private void button1_Click(object sender, EventArgs e)
		{

			System.Net.Mail.MailMessage message = new System.Net.Mail.MailMessage();
			message.To.Add(textBox1.Text);
			message.Subject = "This is the Subject line";
			message.From = new System.Net.Mail.MailAddress("exampleemail.com"); // this is one.com
			message.Body = "This is the message body";
			System.Net.Mail.SmtpClient smtp = new System.Net.Mail.SmtpClient("send.one.com");
			smtp.UseDefaultCredentials = false;
			smtp.Credentials = new System.Net.NetworkCredential("Exampleemail.com", "*********"); //one.com is hosting my mail
			smtp.Send(message);

			MessageBox.Show(" Email send", "Sending");
		}

		private void textBox1_TextChanged(object sender, EventArgs e)
		{

		}


		}
		}



Is This A Good Question/Topic? 0
  • +

Replies To: I got a small problem with my mail sending test program (smtp problems

#2 MentalFloss  Icon User is offline

  • "ADDICTED"[2:5]
  • member icon

Reputation: 528
  • View blog
  • Posts: 1,397
  • Joined: 02-September 09

Re: I got a small problem with my mail sending test program (smtp problems

Posted 21 January 2010 - 09:31 AM

Your host probably just doesn't allow SMTP at all. This is rather common due to the abusive ability an open SMTP server provides.
I would talk to your provider and explain why you need to work through SMTP. Ask them how you can get it working.
Was This Post Helpful? 0
  • +
  • -

#3 DarkHeartz  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 2
  • Joined: 21-January 10

Re: I got a small problem with my mail sending test program (smtp problems

Posted 21 January 2010 - 10:41 AM

View PostMentalFloss, on 21 Jan, 2010 - 08:31 AM, said:

Your host probably just doesn't allow SMTP at all. This is rather common due to the abusive ability an open SMTP server provides.
I would talk to your provider and explain why you need to work through SMTP. Ask them how you can get it working.

thanks for your answer but i tried that before i posted and he didnt knew a thing, when i asked about it he just said they didnt suport C# and then i said no i dont mean Asp and he said we doesnt suport that either, after that i told them that the error was about i wasnt allowed to use the program, and he just told me how to set up an email client, and about the buttons i have to allow, ( i dont think he ever did understand what i was trying to ask )

but isnt there a code that can make me able to use a password protected email, smtp i heard there was a kind of code input that would make it work
Was This Post Helpful? 0
  • +
  • -

#4 MentalFloss  Icon User is offline

  • "ADDICTED"[2:5]
  • member icon

Reputation: 528
  • View blog
  • Posts: 1,397
  • Joined: 02-September 09

Re: I got a small problem with my mail sending test program (smtp problems

Posted 21 January 2010 - 10:48 AM

If you can't do this:
http://www.yuki-onna...email/smtp.html

you're not going to send mail in a program either.

If you can't do that, then you have to talk to your provider about allowing it. If they pretend not to know what you're talking about, I don't know what to tell you.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1