Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8759197
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T14:44:27+00:00 2026-06-13T14:44:27+00:00

E-mail + Attachment (vCard) send. I have no Idea what I am doing wrong,

  • 0

E-mail + Attachment (vCard) send.

I have no Idea what I am doing wrong, searched for similar Questions for 2 days but no question/solution on Stackoverflow or Google fits my description.

Because I’ve writed my code diffrently

Send Mail + Attachment Class:

using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Web.Configuration;
using System.Net.Mail;
using System.Net.Configuration;
using Compulutions.Net;
using Compulutions.Web;
using System.IO;
using System.Web.Mail;
using System.Collections.Generic;
using System.ComponentModel;
using System.Web.Services.Description;

// System.Web.Mail.SmtpMail.SmtpServer
// using System.Web.Mail.SmtpClient;


namespace vCardGenerator.Website
{
    public class SendvCard
    {
        public void MailvCard(string recipient, string filename)
        {
            Mailer smtp = new Mailer("localhost");

            /* SMTP - port 25 */

            smtp.AddAttachment(filename); //.vcf file Path
            smtp.FromAddress = new MailAddress ("random@mail.com");
            smtp.Subject = "vCard";
            smtp.MailBody = "Attachment is a vCard";
            smtp.AddRecipient(recipient);

#if !DEBUG
            try
            {
#endif
                smtp.SendMail();
#if !DEBUG
            }

            catch (Exception ex)
            {
                Response.Write("Exception Occured:   " + ex);
                    //Responds.Write("Sending vCard Failed! Please try again")
            }
#endif


            //  File.Delete(filename);

            //      vCard.vcf Delete after being send
                FileInfo DeleteFileInfo = new FileInfo(filename);

        /*  FileInfo DeleteFileInfo = new FileInfo("C:\\local\\vCardGenerator.Website" + "\\" + "FirstName_LastName" + ".vcf");
            if (DeleteFileInfo.Exists)
                File.Delete("C:\\local\\vCardGenerator.Website" + "\\" + "FirstName_LastName" + ".vcf"); */
        }
    }
}

Button Send:

protected void btnSend_Click(object sender, EventArgs e)
{
// Send mail with attachment
using (Attachment data = new Attachment("C:\\local\\vCardGenerator.Website\\" + "FirstName_LastName.vcf", MediaTypeNames.Application.Octet))
{

SendvCard smtp = new SendvCard();
}

lblStatus.Text = "Send to:" + " " + txtMail.Text;

FileInfo DeleteFileInfo = new FileInfo("C:\\local\\vCardGenerator.Website" + "\\" + "FirstName_LastName" + ".vcf");
if (DeleteFileInfo.Exists)
File.Delete("C:\\local\\vCardGenerator.Website" + "\\" + "FirstName_LastName" +".vcf");
  }
 }
}

Willing to provide any other/more information if needed.

Trying to get help of the professionals so atleast give me an solution, before burning me.

Sincerely,
Hopeless Creature.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T14:44:29+00:00Added an answer on June 13, 2026 at 2:44 pm

    Looks like you have only created an instance of SendvCard and are not invoking the send method in the class (MailvCard).

     SendvCard smtp = new SendvCard();
    
     smtp.MailvCard("user@domain.com", "filename"); // calls the method on the class
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i have function to send mail with attachment to microsoft exchange server. My problem
I'm sending a simple mail with attachment using SmtpClient but I get this error:
Hi I want to send attachment with mail using javaMailAPI. my code is: public
I want to use php mailer for sending multiple attachment in mail. But the
This sends the mail but the attachment doesn't appear. { Intent mailIntent = new
I want to send booking information through mail in an attachment to add in
i am doing mail concepts. in this i want to send a dynamic attachments
1.Here i am trying to send my jpg image file as attachment to mail
I have the following code in script my.ps1 . .... $attach = New-Object System.Net.Mail.Attachment(c:\my.log)
I want to record a .caf file then send it as a mail attachment

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.