Welcome Guest! To enable all features please Login or Register.

Notification

Icon
Error

Options
Go to last post Go to first unread
miranda59  
#1 Posted : Friday, February 21, 2014 9:57:55 PM(UTC)
miranda59

Rank: Newbie

Groups: Registered
Joined: 2/21/2014(UTC)
Posts: 1
Nigeria
Location: Lagos

PLss help. this is the error i get when i try to send mail with image attachment using the html.csharp sample code:
Exception: NEtworking Error:10060 A connection attempt failed because the connected party did not properly respond after a period of time or established connection failed because connected host has failed to respond 74.125.136.109.25
ivan  
#2 Posted : Saturday, February 22, 2014 3:19:26 AM(UTC)
ivan

Rank: Administration

Groups: Administrators
Joined: 11/11/2010(UTC)
Posts: 1,148

Thanks: 9 times
Was thanked: 54 time(s) in 54 post(s)

It seems that your outgoing 25 port is blocked by your router/firewall/anti-virus/ISP, in this case, you can try to use 587 or 465 port
in the sample, you can input

smtp.gmail.com 587
smtp.gmail.com 465

as the server address and have SSL checked, then try to send the email
miranda59  
#3 Posted : Saturday, February 22, 2014 9:45:09 PM(UTC)
miranda59

Rank: Newbie

Groups: Registered
Joined: 2/21/2014(UTC)
Posts: 1
Nigeria
Location: Lagos

HI Ivan, Supper. Thanks! that worked.
How do i attach an html file to the body of the email not as an attachment.
Thanx
ivan  
#4 Posted : Saturday, February 22, 2014 10:06:54 PM(UTC)
ivan

Rank: Administration

Groups: Administrators
Joined: 11/11/2010(UTC)
Posts: 1,148

Thanks: 9 times
Was thanked: 54 time(s) in 54 post(s)
miranda59  
#5 Posted : Tuesday, February 25, 2014 3:58:33 AM(UTC)
miranda59

Rank: Newbie

Groups: Registered
Joined: 2/21/2014(UTC)
Posts: 1
Nigeria
Location: Lagos

Thanx Ivan, that worked only for a while then it starts sending only characters as the HTML.
I have tried creating a new html file which works only once or twice and then it starts sending the
chars again. Any suggestions?
ivan  
#6 Posted : Tuesday, February 25, 2014 4:47:14 AM(UTC)
ivan

Rank: Administration

Groups: Administrators
Joined: 11/11/2010(UTC)
Posts: 1,148

Thanks: 9 times
Was thanked: 54 time(s) in 54 post(s)
could you show me your source code?
miranda59  
#7 Posted : Tuesday, February 25, 2014 5:07:19 AM(UTC)
miranda59

Rank: Newbie

Groups: Registered
Joined: 2/21/2014(UTC)
Posts: 1
Nigeria
Location: Lagos

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
// Add EASendMail namespace
using EASendMail;

namespace EmailList
{
class Program
{
static void Main(string[] args)
{


SmtpMail oMail = new SmtpMail("TryIt");
SmtpClient oSmtp = new SmtpClient();

// Set sender email address, please change it to yours
oMail.From = "from email";

// Set recipient email address, please change it to yours
oMail.To = "to email";

// Set email subject
oMail.Subject = "Cocktail Invite";


// Your SMTP server address
SmtpServer oServer = new SmtpServer("smtp.gmail.com");

// User and password for ESMTP authentication, if your server doesn't require
// User authentication, please remove the following codes.
oServer.User = "mymail";
oServer.Password = "mypass";

// If your smtp server requires implicit SSL connection on 465 port, please add this line
oServer.Port = 465;
oServer.ConnectType = SmtpConnectType.ConnectSSLAuto;


try
{
// Import html body and also import linked image as embedded images.
oMail.ImportHtmlBody("C:\\Users\\COMPUTER2\\Desktop\\test.htm",
ImportHtmlBodyOptions.ImportLocalPictures | ImportHtmlBodyOptions.ImportCss);

oMail.SaveAs("C:\\Users\\COMPUTER2\\Desktop\\test.htm", true);

Console.WriteLine("start to send email ...");
oSmtp.SendMail(oServer, oMail);
Console.WriteLine("email was sent successfully!");
}
catch (Exception ep)
{
Console.WriteLine("failed to send email with the following error:");
Console.WriteLine(ep.Message);
}
}
}
}


ivan  
#8 Posted : Tuesday, February 25, 2014 6:41:28 AM(UTC)
ivan

Rank: Administration

Groups: Administrators
Joined: 11/11/2010(UTC)
Posts: 1,148

Thanks: 9 times
Was thanked: 54 time(s) in 54 post(s)
Your codes have no problem.

when you

call

oMail.SaveAs("C:\\Users\\COMPUTER2\\Desktop\\test.htm", true);

please save it as

oMail.SaveAs("C:\\Users\\COMPUTER2\\Desktop\\test.eml", true);

then you can see the correct email.
miranda59  
#9 Posted : Tuesday, February 25, 2014 8:12:50 AM(UTC)
miranda59

Rank: Newbie

Groups: Registered
Joined: 2/21/2014(UTC)
Posts: 1
Nigeria
Location: Lagos

Thnx Ivan. that solved it
Users browsing this topic
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.

Powered by YAF.NET | YAF.NET © 2003-2024, Yet Another Forum.NET
This page was generated in 0.096 seconds.

EXPLORE TUTORIALS

© All Rights Reserved, AIFEI Software Limited & AdminSystem Software Limited.