I have mailbox with forward to gmail acound in 1and1 hosting
<smtp deliveryMethod="Network" >
<network host="smtp.1and1.com" port="25" userNameemail@example.com password="mailbox-password" defaultCredentials = "true" />
protected void submit_Click(object sender, EventArgs e)
MailMessage msg = new MailMessage();
msg.From =new MailAddress(txtEmail.Text.Trim());
msg.Subject = txtName.Text.Trim();
msg.Body ="message: " + txtContent.Text.Trim() + "<br /><br />" + "phone: " + txtPhone.Text.Trim() + "<br /><br />";
SmtpClient smpt = new SmtpClient();
lblOk.Text ="faild to deliver ";
The code is not working and not bringing me an error. Does anyone can tell me what is wrong????
I think you have to provide the SMTP Credentials , See the below code
MailMessage m = new MailMessage ("firstname.lastname@example.org", "email@example.com", "This is the subject for the authorized email.", "This is the body of the authorized mail!..."); // Send the message using authorization SmtpClient client = new SmtpClient("smtp.w3mentor.com"); client.Credentials = CredentialCache.DefaultNetworkCredentials; // or client.Credentials = new NetworkCredential("user", "password"); client.Send(m);
Also check the server name is correct. For the UK I know it is auth.smtp.1and1.co.uk, so yours might well be auth.smtp.1and1.com
Thanks you for your comments, but it didnt worked.
This is the script from 1and1 faq in vb
does anyone know how to convert this to c#?
mazal0404I have mailbox with forward to gmail acound in 1and1 hosting
If it's going to gmail, shouldn't you be trying to get it from gmail?
mazal0404does anyone know how to convert this to c#?