怎樣用Sendmail發送HTML格式的郵件

來源:互聯網
上載者:User

HTML格式郵件就是網頁格式郵件,其他郵件中不能帶有字型大小,顏色設定,不能插入圖片。HTML郵件可以做到這些,相當於你的郵件就是一個網頁了。想不想用Sendmail發送HTML格式的郵件,跟我來看看吧。

先將來自HTML頁面的資料解碼,再調用unix系統sendmail命令即可。

例如下:#!/usr/local/bin/perl

#

&readparse;

print "Content-type: text/htmlnn";

#

#********* BEGIN BODY********************

#******** END BODY************************

#

# EACH VALUE IN THE HTML FORM WILL BE CONTAINED IN

# THE THE @VALUE ARRAY.

sub readparse {

read(STDIN,$user_string,$ENV{'CONTENT_LENGTH'});

if (length($ENV{'QUERY_STRING'})>0) {$user_string=$ENV{'QUERY_STRING'}

};

$user_string =~ s/+/ /g;

@name_value_pairs = split(/&/,$user_string);

foreach $name_value_pair (@name_value_pairs) {

($keyword,$value) = split(/=/,$name_value_pair);

$value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C",hex($1))/ge;

push(@value, "$value");

$user_data{$keyword} = $value;

if ($value=~/

怎麼樣,學會用Sendmail來發送HTML格式的郵件嗎,加把勁!

  • Sendmail簡單介紹
  • 如何在Sendmail裡設定虛擬域
  • 圖文並茂 講解Sendmail工作環境
  • Sendmail的安全篇之Smrsh
  • Sendmail的安全篇之未授權人非法濫用
  • Linux下的Sendmail配置的簡單流程
  • 深入瞭解 Linux下安裝DNS+Sendmail服務

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.